title: How to get server name and database from config file
body: <p>I have a connection string in my config file and i am using it in my code as follows -</p>
  
  <pre><code>SqlConnection sqlconn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBCentralW2"].ConnectionString);
  </code></pre>
  
  <p>I need to get the server name and the database from this and pass it as a parameter to my stored proc.</p>
  
  <p>I am trying to get it as below but it is failing.</p>
  
  <pre><code>SqlConnection sqlconn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBCentralW2"].ConnectionString);
  SqlConnectionStringBuilder conbuilder = new SqlConnectionStringBuilder();
  conbuilder.ConnectionString = sqlconn.ToString();
  string server = conbuilder.DataSource;
  string database = conbuilder.InitialCatalog;
  </code></pre>
  
  <p>Please help me get the database and server name from my config file</p>