⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oledb.aspx.cs

📁 关于ASP.NET制作程序模块
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["connectionoledb"].ConnectionString);
        try
        {
            //打开sql server数据库的连接
            con.Open();
            //显示连接成功的信息
            Response.Write("链接oledb数据源的状态:" + con.State.ToString() +"<br>");
            Response.Write("连接oledb数据源的数据源为:" + con.DataSource.ToString() + "<br>");
            Response.Write("链接oledb数据源的字符串为:" + con.ConnectionString.ToString() + "<br>");
            Response.Write("链接oledb数据源超时的时间为:" + con.ConnectionTimeout.ToString() + "<br>");
            con.Close();
            Response.Write("链接oledb数据源的状态:" + con.State.ToString());
            //结束response操作对象
            Response.End();
        }
        catch (Exception ex)
        {
            //抛出数据库连接异常
            Response.Write(ex.Message);
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -