ASP.NET获取MS SQL Server安装实例
2014-08-29来源:易贤网

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"]));

}

}

更多信息请查看IT技术专栏

推荐信息