Created
October 17, 2012 06:12
-
-
Save sharat/3903949 to your computer and use it in GitHub Desktop.
Function to check SQLServer Data Sources and version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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