title: connection.ServerVersion' threw an exception of type 'System.InvalidOperationException'
body: <p>I get this error when connection to my database from codebehind.</p>
  
  <blockquote>
    <p>'connection.ServerVersion' threw an exception of type
    'System.InvalidOperationException'</p>
    
    <p>connection.ServerVersion 10.50.2500</p>
  </blockquote>
  
  <p>But using the <code>asp:SqlDataSource</code> controller with the same connectionstring works fine.</p>
  
  <p>I am really frustrated - do anybody have a input!</p>
  
  <p>I get the exception here:</p>
  
  <pre><code>using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ServiceDepartmentSqlConnection"].ConnectionString))
   {}
  </code></pre>
  
  <p>Here is an example of the configuration string which does not work:</p>
  
  <pre><code>&lt;add name="ServiceDepartmentSqlConnection" connectionString="Data Source=serverIp;Initial Catalog=UserName;User ID=UserId;Password=Password" providerName="System.Data.SqlClient" /&gt;
  </code></pre>