title: C# MySqlConnection won't close
body: <p>I have an application that fires a mysql command (query) "show databases", the query works and returns properly but I can't close my connections. The user I used had 24 connections allowed at the same time so the problem popped up further down my program but reducing the allowed connections to 2 shows me that I can't even close the first query (which isn't in a loop). The code is the following:</p>
  
  <pre><code>    protected override Dictionary&lt;string, Jerow_class_generator.Database&gt; loadDatabases()
      {
          MySqlConnection sqlCon = new MySqlConnection(this.ConnectionString);
          sqlCon.Open();
  
          MySqlCommand sqlCom = new MySqlCommand();
          sqlCom.Connection = sqlCon;
          sqlCom.CommandType = CommandType.Text;
          sqlCom.CommandText = "show databases;";
  
          MySqlDataReader sqlDR;
          sqlDR = sqlCom.ExecuteReader();
  
          Dictionary&lt;string, Jerow_class_generator.Database&gt; databases = new Dictionary&lt;string, Jerow_class_generator.Database&gt;();
          string[] systemDatabases = new string[] { "information_schema", "mysql" };
  
          while (sqlDR.Read())
          {
              string dbName = sqlDR.GetString(0);
              if (!systemDatabases.Contains(dbName))
              {
                  databases.Add(sqlDR.GetString(0), new MySQL.Database(dbName, this));
              }
          }
  
          sqlCom.Dispose();
          sqlDR.Close();
  
          sqlCon.Close();
          sqlCon.Dispose();
          return databases;
      }
  </code></pre>
  
  <p>P.S. The 'New MySQL.Database(dbName, this));' is my owm made class which only stores the DB structure, could be considered irrelevant.</p>
  
  <p>The exact error I get is 'max_user_connections'. on the connection.open line of the next time a query needs to be fired.</p>