title: Connection string was not found
body: <p>I am trying to run this code:</p>
  
  <pre><code>var db = Database.Open("DBNAME");
  var q  = "Select Name From Table";
  
  @foreach(var row in db.Query(q)){
        &lt;li&gt; @row.Name &lt;/li&gt;
  }
  </code></pre>
  
  <p>But I get the error <code>System.InvalidOperationException: Connection string "DBNAME" was not found.</code></p>
  
  <p>So I went in to WebMatrix 3 and added this database under <code>Other Connections</code> and working fine in the WebMatrix3 app.  But the connection string I fed WebMatrix to add to the connections was not appended to the web.config file, and I still get this error, so not sure what else to do?  Suggestions?</p>
  
  <p>Also, do DB connections like this have to be closed?  I did not see a close statement in the example I took this from, which is from here: <a href="http://www.w3schools.com/aspnet/webpages_database.asp" rel="nofollow">http://www.w3schools.com/aspnet/webpages_database.asp</a></p>
  
  <hr>
  
  <p>Update: I added the following setting in web.config:</p>
  
  <pre><code> &lt;connectionStrings&gt;
     &lt;add name="DBNAME" connectionString="server=(local)\Server;database=DBNAME;uid=myUser;password=myPass;" /&gt;
   &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>And now I get the following error instead: <code>System.ArgumentException: Keyword not supported: 'server'.</code> &lt;-- this error shows up for the <code>@foreach</code> line</p>