title: Database connection not closing windows form
body: <p>I seem to be having an issue closing my Database Connection (Program.DB_CONNECTION).</p>
  
  <p>When I close the form I run Program.DB_CONNECTION.Close but this dosnt seem to close the connection as the database lock file is still there and I cannot delete the database.</p>
  
  <p>Can anyone see what I am doing wrong for the database not to close?</p>
  
  <pre><code>private void update_gic_attendances()
      {
          OleDbCommand com = new OleDbCommand("SELECT count(*), [Squadron] FROM Personnel WHERE [Position] = ? and [Current?] = TRUE GROUP BY [Squadron]", Program.DB_CONNECTION);
          com.Parameters.Add(new OleDbParameter("", PositionIDs.GIC));
  
          OleDbDataReader dr = com.ExecuteReader();
  
          while (dr.Read())
          {
              try
              {
                  OleDbCommand com2 = new OleDbCommand("SELECT * FROM GIC_Attendances WHERE [Attendance_Date] = ? AND [Squadron] = ?", Program.DB_CONNECTION);
                  com2.Parameters.Add(new OleDbParameter("", DateTime.Today.Date));
                  com2.Parameters.Add(new OleDbParameter("", dr.GetInt32(1)));
  
                  OleDbDataReader dr2 = com2.ExecuteReader();
  
                  if (dr2.HasRows)
                  {
                      //update the number of attendees
                      OleDbCommand com3 = new OleDbCommand("UPDATE GIC_Attendances SET [Number_Attended] = ? WHERE [Attendance_Date] = ? AND [Squadron] = ?", Program.DB_CONNECTION);
                      com3.Parameters.Add(new OleDbParameter("", dr.GetInt32(0)));
                      com3.Parameters.Add(new OleDbParameter("", DateTime.Today.Date));
                      com3.Parameters.Add(new OleDbParameter("", dr.GetInt32(1)));
  
                      com3.ExecuteNonQuery();
                  }
                  else
                  {
                      OleDbCommand com3 = new OleDbCommand("INSERT INTO GIC_Attendances ([Attendance_Date], [Squadron], [Number_Attended], [Number_Expected], [AddedOnSlave]) VALUES (?, ?, ?, ?, TRUE)", Program.DB_CONNECTION);
                      com3.Parameters.Add(new OleDbParameter("", DateTime.Today.Date));
                      com3.Parameters.Add(new OleDbParameter("", dr.GetInt32(1)));
                      com3.Parameters.Add(new OleDbParameter("", dr.GetInt32(0)));
                      com3.Parameters.Add(new OleDbParameter("", 4));
  
                      com3.ExecuteNonQuery();
                  }
  
                  dr2.Close();
              }
              catch
              {
              }
          }
  
          dr.Close();
      }
  </code></pre>