using Microsoft.SqlServer.Management.Smo;
protected void Button1_Click(object sender, EventArgs e)
{
DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Response.Write(dr["Name"].ToString() + "
");
}
}
}Note: You have to add a Reference of Microsoft.SqlServer.Smo dll.
No comments:
Post a Comment