开发者

Enumerate available SQL Servers from .Net

Anyone know if there is a more "up to date" way of enumerating all available SQL Server instances via .Net, i.e. without using System.Data - DataTable/DataRow bits.

SqlDataSourceEnumerator sqlEnumerator = SqlDataSourceEnumerator.Instance;
DataTable dt = sqlEnumerator.GetDataSources();
foreach(DataRow row in dt.Rows)
{
    Console.WriteLine(row["ServerName"]开发者_JAVA百科);
    Console.WriteLine(row["InstanceName"]);
    Console.WriteLine("*******************************");
}


You can find several answers here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜