title: ConnectionString null after reading from app.config
body: <p>I'm programming in C# with VS 2010.
  I stored my ConnectionString in an app.config - file and read from it, when I want to open the connection to the database. Unfortunately, the connectionstring is always "null", whatever I'm doing. Here is my app.config - file, which I renamed to "options.config".</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;connectionStrings&gt;
      &lt;add name="connstring"
       connectionString="Data Source=10.10.10.10;Initial Catalog=testdb;Integrated Security=SSPI"/&gt;
    &lt;/connectionStrings&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I also added the reference to the System.configuration - assembly.</p>
  
  <p>Then just reading from config - file:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Configuration;
  using System.Collections.Specialized;
  
  namespace Test_Class
  {
     public abstract class SQLConnectionString
      {
     static string connectionstring = ConfigurationManager.ConnectionStrings["connstring"].ConnectionString;
  
     public static string ConnectionString 
     {
         get
         {
             return connectionstring;
         }
         }
  }
  }
  </code></pre>