title: When should I open and close a connection to SQL Server
body: <p>I have a simple static class with a few methods in it. Each of those methods open a SqlConnection, query the database and close the connection. This way, I am sure that I always close the connection to the database, but on the other hand, I don't like to always open and close connection. Below is an example of what my methods look like.</p>
  
  <pre><code>public static void AddSomething(string something)
  {
      using (SqlConnection connection = new SqlConnection("..."))
      {
          connection.Open();
          // ...
          connection.Close();
      }
  }
  </code></pre>
  
  <p>Considering that the methods are inside a static class, should I have a static member containing a single SqlConnection? How and when should I drop it? What are the best practices?</p>