Csharp/CSharp Tutorial/ADO.Net/SqlDataSourceEnumerator — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 15:19, 26 мая 2010
Obtain the DataTable of SQL Server instances and display the list of the SQL Servers
<source lang="csharp">using System; using System.Data; using System.Data.Sql; class MainClass {
public static void Main(string[] args) { using (DataTable SqlSources = SqlDataSourceEnumerator.Instance.GetDataSources()) { foreach (DataRow source in SqlSources.Rows) { Console.WriteLine(" Server Name:{0}", source["ServerName"]); Console.WriteLine(" Instance Name:{0}", source["InstanceName"]); Console.WriteLine(" Is Clustered:{0}", source["IsClustered"]); Console.WriteLine(" Version:{0}", source["Version"]); } } }
}</source>