title: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
body: <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where LastName=Iguin' at line 1 </p>
  
  <p>i can't fix the error :( can someone help me please</p>
  
  <p>this is my code</p>
  
  <pre><code>try
  {
      string contactNumVal = txtColContact.Text;
  
      if (contactNumVal.Length &lt; 11)
      {
          MessageBox.Show("The Contact Number must have 11 digit");
      }
      else
      {
          DialogResult dw;
  
          dw = MessageBox.Show("Are you sure you want to Edit this data", "Confirm Deletion", MessageBoxButtons.YesNo);
          if (dw == DialogResult.Yes)
          {
              string MyConString = "SERVER=localhost;" +
                       "DATABASE=prototype_db;" +
                       "UID=root;";
              using (MySqlConnection connection = new MySqlConnection(MyConString))
              {
                  connection.Open();
                  DataTable dt = new DataTable();
                  using (MySqlDataAdapter da = new MySqlDataAdapter("Select Collector_ID, LastName, " +
                                "FirstName,MiddleName,Address,ContactNo,BirtDay,Gender" +
                                "from collector_profile where LastName like @clname", connection))
                  {
                      da.SelectCommand.Parameters.AddWithValue("@clname", "%" + txtColLname.Text + "%");
  
                      da.Fill(dt);
  
                      dt.Rows[0].BeginEdit();
  
                      dt.Rows[0][1] = txtColLname.Text;
                      dt.Rows[0][2] = txtColFname.Text;
                      dt.Rows[0][3] = txtColMname.Text;
                      dt.Rows[0][4] = txtColAddress.Text;
                      dt.Rows[0][5] = txtColContact.Text;
                      dt.Rows[0][6] = dtpCbday.ToString();
                      dt.Rows[0][7] = cmbCgender.SelectedItem.ToString();
  
                      dt.Rows[0].EndEdit();
                      MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
                      da.Update(dt);
  
                      connection.Close();
                  }
              }
  
              MessageBox.Show("Data is now updated");
          }
  
      }
  }
  
  catch (Exception error)
  {
      MessageBox.Show(error.ToString());
  }
  </code></pre>