复制代码 代码如下:
Server: <asp:DropDownList runat="server"></asp:DropDownList>
复制代码 代码如下:
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"]));
}
}
新闻热点
疑难解答
图片精选