title: Exception thrown: 'System.Collections.Generic.KeyNotFoundException' in mscorlib.dll when using a SELECT query
body: <pre><code>try
  {
      string connString = "server=db4free.net;port=3306;database=secretdb;user id=secret;password=secret;charset=utf8";
      MySqlConnection conn = new MySqlConnection(connString);
      conn.Open();
      MySqlCommand cmd = new MySqlCommand("SELECT School_Name FROM schools WHERE School_ID=@id", conn);
      cmd.Parameters.AddWithValue("@id", "1");
      var schoolName = cmd.ExecuteScalar();
      label1.Text = schoolName.ToString();
      conn.close();
  }
  catch (Exception ex)
  {
      MessageBox.Show(ex.Message);
  }
  </code></pre>
  
  <p>The code above returns the exception <strong>Exception thrown: 'System.Collections.Generic.KeyNotFoundException' in mscorlib.dll</strong></p>
  
  <p>However whenever I used a query such as <strong>INSERT, UPDATE, and DELETE it works just fine</strong>. Just like the code below:</p>
  
  <pre><code>try
  {
      string connString = "server=db4free.net;port=3306;database=secretdb;user id=secret;password=secret;charset=utf8";
      MySqlConnection conn = new MySqlConnection(connString);
      conn.Open();
      MySqlCommand cmd = new MySqlCommand("INSERT INTO schools(School_Name,School_Address) VALUES(@name,@address)", conn);
      cmd.Parameters.AddWithValue("@name", "Sample Name");
      cmd.Parameters.AddWithValue("@address", "Sample Address");
      cmd.ExecuteNonQuery();
      label1.Text = "Success";
      conn.Close();
  }
  catch (Exception ex)
  {
      MessageBox.Show(ex.Message);
  }
  </code></pre>
  
  <p>So basically my problem is the following:</p>
  
  <ol>
  <li>The first block of code works just fine if used in <strong>Xamarin.Forms</strong> (tested in Android). I can SELECT from the database.</li>
  <li>The first block of code doesn't work if used in <strong>Windows Forms App</strong> and returns the said exception. Both Xamarin.Forms and Windows Forms App runs on C# so I don't exactly know why this is happening.</li>
  <li>The second block of code works just fine in both <strong>Xamarin.Forms</strong> and <strong>Windows Forms App</strong>.</li>
  <li>Basically, I can run any SQL query but not SELECT.</li>
  </ol>