Skip to content

Instantly share code, notes, and snippets.

@sharat
Created October 17, 2012 06:12
Show Gist options
  • Save sharat/3903949 to your computer and use it in GitHub Desktop.
Save sharat/3903949 to your computer and use it in GitHub Desktop.
Function to check SQLServer Data Sources and version
private static void PrintSQLServerInfo()
{
SqlDataSourceEnumerator dataSourceEnumarator = SqlDataSourceEnumerator.Instance;
DataTable dataTable = dataSourceEnumarator.GetDataSources();
foreach (DataRow row in dataTable.Rows)
{
Console.WriteLine("----------------------------Sources----------------------------");
Console.WriteLine("Server Name:" + row["ServerName"]);
Console.WriteLine("Instance Name:" + row["InstanceName"]);
Console.WriteLine("Is Clustered:" + row["IsClustered"]);
Console.WriteLine("Version:" + row["Version"]);
Console.WriteLine("---------------------------------------------------------------");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment