title: Invalid parameters in SQLConnection
body: <p>I have a .NET application that connects to a database. </p>
  
  <p>In my <code>web.config</code> file I have</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="TFOUNDATION" 
           connectionString="Data Source=TAPOLCISQL01;Initial Catalog=TapolciFoundation;Persist Security Info=True;User ID=XXXX;Password=XXXXX" 
           providerName="System.Data.SqlClient"/&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Username and password removed. </p>
  
  <p>In my code behind I open the connection like this</p>
  
  <pre><code>protected void grabData()
  {
      SqlCommand cmd = new SqlCommand("SELECT FirstName FROM CauseMarketers", new SqlConnection(ConfigurationManager.ConnectionStrings["TFOUNDATION"]));
  }
  </code></pre>
  
  <p>The error I'm receiving is</p>
  
  <blockquote>
    <p>The best overload method match for "System.Data.SQLClient.SQLConnection.SQLConnection(string)" has some invalid arguments. </p>
  </blockquote>
  
  <p>I'm not sure what I'm doing wrong here. </p>