title: How do I write an external connection string config file and make my c# application recognize and read it?
body: <p>My current c# windows form application is using the following code to connect to a database to retrieve information and the it is stored at Setting.cs</p>
  
  <pre><code>public static String connectionString ="Data Source=####; Initial Catalog=###; User ID=####; Password='####'";
  </code></pre>
  
  <p>I have written out an external Connection.config file and the content would be :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;connectionStrings&gt;
      &lt;add name="Connection" providerName="System.Data.providername" 
           connectionString="Data Source=####; Initial Catalog=###; User ID=###;                      Password='####!';" /&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>is the above code written correctly? as I sort of just copied and paste online and editted the connection string part as i do not know what does the "add name" and providerName part does.</p>
  
  <p>what i would like to ask is where should i write the code in my forms to read the connection string from my external config file so i can remove the one in my setting.cs file.</p>
  
  <p>thank you.</p>
  
  <p>don mind the ### as it is just replaced by me to represent the information.</p>