萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp.net編程 >> ASP.NET獲取MS SQL Server安裝實例

ASP.NET獲取MS SQL Server安裝實例

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

  }

  }

copyright © 萬盛學電腦網 all rights reserved