title: How to get SQL Server names without connection string
body: <p>Work on C#, in one of my application I need to get the SQL Server names. In network I have SQL Server 2000, 2005, 2008. For my application I want to get the server names.</p>
  
  <pre><code>private string strConnection = @"Data Source=xxx;Initial Catalog=xxx;Integrated Security=True";
  
  SqlConnection objConnection = new SqlConnection(strConnection);
  objConnection.Open();
  SqlCommand objCommand = new SqlCommand(“xxxxxxx”);
  objCommand.ExecuteNonQuery();
  objConnection.Close();
  </code></pre>
  
  <p>If I know <code>strConnection</code> then I can use the above syntax. But I don’t know the server name. In my application first I need to know the server name. I need help to get the server names.</p>