GetDataSources : SqlDataSourceEnumerator : Database C# Source Code


Custom Search

C# Source Code » Database » SqlDataSourceEnumerator »

 

GetDataSources








    
 


using System;
using System.Data;
using System.Data.Sql;

class MainClass {
    public static void Main(string[] args) {
        using (DataTable SqlSources = SqlDataSourceEnumerator.Instance.GetDataSources()) {
            Console.WriteLine("Discover SQL Server Instances:");
            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"]);
            }
        }
    }

}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Database
» SqlDataSourceEnumerator