title: Parameter @ must be defined
body: <p>This situation often I met when my query is too long. I have defined parameter @no_registrasi, but it still error.</p>
  
  <blockquote>
    <p>MySql.Data.MySqlClient.MySqlException: Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException: Parameter '@no_registrasi' must be defined.</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>        void Tombol_cari_simpanan1Click(object sender, EventArgs e)
      {
          string connectionString = "Server=localhost;User ID=root;Password=;Database=koperasi;Convert Zero Datetime=True;";
          MySql.Data.MySqlClient.MySqlConnection connect = new MySql.Data.MySqlClient.MySqlConnection(connectionString);
          connect.Open();
          string query = "select * from simpanan left join anggota on simpanan.no_registrasi = anggota.no_registrasi left join jenis_simpanan on simpanan.id_jenis_simpanan = jenis_simpanan.id_jenis_simpanan where simpanan.no_registrasi = @no_registrasi";
          MySql.Data.MySqlClient.MySqlCommand myCommand = new MySql.Data.MySqlClient.MySqlCommand(query, connect);
          myCommand.Parameters.AddWithValue("@no_registrasi", int.Parse(textbox_pencarian_no_registrasi.Text));
          MySql.Data.MySqlClient.MySqlDataReader reader=myCommand.ExecuteReader();
          connect.Close();
          mySqlDataAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter(query, connect);
          DataSet DS = new DataSet();
          mySqlDataAdapter.Fill(DS);
          datagrid_simpanan.DataSource = DS.Tables[0];
          connect.Close();    
      }
  </code></pre>