title: .Net MySql error "The given key was not present in the dictionary"
body: <p>Trying to get simple count from table results in exception bellow.
  Tried different select statemens which also makes exception: "<code>SELECT * FROM goods</code>", but "<code>SELECT col1, col2 FROM goods</code>" - works without exception. What am I doing wrong? From workbench these selects works.</p>
  
  <blockquote>
    <p>The given key was not present in the dictionary.
    System.Collections.Generic.KeyNotFoundException: The given key was not
    present in the dictionary.    at
    System.Collections.Generic.Dictionary`2.get_Item(TKey key)    at
    MySql.Data.MySqlClient.MySqlField.SetFieldEncoding()    at
    MySql.Data.MySqlClient.NativeDriver.GetColumnData(MySqlField field)<br>
    at MySql.Data.MySqlClient.NativeDriver.GetColumnsData(MySqlField[]
    columns)    at MySql.Data.MySqlClient.Driver.GetColumns(Int32 count)<br>
    at MySql.Data.MySqlClient.ResultSet.LoadColumns(Int32 numCols)    at
    MySql.Data.MySqlClient.ResultSet..ctor(Driver d, Int32 statementId,
    Int32 numCols)    at MySql.Data.MySqlClient.Driver.NextResult(Int32
    statementId, Boolean force)    at
    MySql.Data.MySqlClient.MySqlDataReader.NextResult()    at
    MySql.Data.MySqlClient.MySqlDataReader.Close()    at
    MySql.Data.MySqlClient.MySqlCommand.ResetReader()    at
    MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior
    behavior)    at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()<br>
    at MySqlSybaseComparer.DbTester.Test(String&amp; error) in
    c:\MySqlSybaseComparer\DbTester.cs:line 68</p>
  </blockquote>
  
  <p>code snippet:</p>
  
  <pre><code>using (MySqlConnection conn = new MySqlConnection(ConStrMySql))
  {
      try
      {
          conn.Open();
          using (MySqlCommand cmd = new MySqlCommand("SELECT count(*) FROM goods", conn))
          {
              using (MySqlDataReader reader = cmd.ExecuteReader())
              {
                  if (reader.Read())
                      MessageBox.Show(reader[0].ToString());
              }
          }
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message + Environment.NewLine + ex.ToString(););
      }
      conn.Close();
  }
  </code></pre>
  
  <p>Connection string to DB: <code>Server=localhost; Database=art; Uid=ramunas; Pwd=xxxx; AllowUserVariables=True;</code></p>