WEB开发网
开发学院WEB开发ASP.NET ASP.NET获取MS SQL Server安装实例 阅读

ASP.NET获取MS SQL Server安装实例

 2013-03-15 14:07:39 来源:开发学院   
核心提示:View Code protected void Page_Load(object sender, EventArgs e) { DataTable dataTable = SqlDataSourceEnumerator.Instance.GetDataSources(); forea
View Code 

protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dataTable = SqlDataSourceEnumerator.Instance.GetDataSources();

        foreach (DataRow dr in dataTable.Rows)
        {
            if (string.IsNullOrEmpty(dr["InstanceName"].ToString()))
               this.DropDownListInstance.Items.Add(string.Concat(dr["ServerName"]));
            else
               this.DropDownListInstance.Items.Add(string.Concat(dr["ServerName"], "\\", dr["InstanceName"]));
        }
    }

Tags:ASP NET 获取

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接