title: Fatal error during command execution (MySQL, VBNET)
body: <p>I have a form that have multiple fields. And this form can Add,Edit,Save and Update records. But the Update button gives me error of "Fatal error during command execution" which is I dont know how to find the error in my codes. Here is my codes.</p>
  
  <pre><code> Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As    System.EventArgs) Handles btnUpdate.Click
      conn = New MySqlConnection
      conn.ConnectionString = "server=localhost; userid=root; password=root;   database=dbase"
  
      Try
  
          conn.Open()
          Sql = "UPDATE dbase.tblfacultyinfo SET firstname = @firstname, " &amp; _
                                          "middlename = @middlename," &amp; _
                                          "lastname = @lastname," &amp; _
                                          "gender = @gender," &amp; _
                                          "birthdate = @birthdate," &amp; _
                                          "age = @age," &amp; _
                                          "emailAdd = @emailAdd," &amp; _
                                          "contact_mobileno = @contact_mobileno," &amp; _
                                          "contact_telno = @contact_telno," &amp; _
                                          "homeadd_houseno = @homeadd_houseno," &amp; _
                                          "homeadd_street = @homeadd_street," &amp; _
                                          "homeadd_brgy = @homeadd_brgy," &amp; _
                                          "homeadd_town = @homeadd_town," &amp; _
                                          "tersiary_schoolname = @tersiary_schoolname," &amp; _
                                          "tersiary_address = @tersiary_address," &amp; _
                                          "tersiary_degree = @tersiary_degree," &amp; _
                                          "tersiary_batch = @tersiary_batch," &amp; _
                                          "secondary_schoolname = @secondary_schoolname," &amp; _
                                          "secondary_address = @secondary_address," &amp; _
                                          "secondary_batch = @secondary_batch" &amp; _
                                          "WHERE facultyNo = @facultyNo"
          With cmd
              .Connection = conn
              .CommandText = Sql
              .CommandType = CommandType.Text
              .Parameters.AddWithValue("@facultyNo", txtFacultyNo.Text)
              .Parameters.AddWithValue("@firstname", txtFirstname.Text)
              .Parameters.AddWithValue("@middlename", txtMiddlename.Text)
              .Parameters.AddWithValue("@lastname", txtLastname.Text)
              .Parameters.AddWithValue("@gender", cbGender.Text)
              .Parameters.AddWithValue("@birthdate", dtpBirthdate.Value)
              .Parameters.AddWithValue("@age", txtAge.Text)
              .Parameters.AddWithValue("@emailAdd", txtEmailAdd.Text)
              .Parameters.AddWithValue("@contact_mobileno", txtContact_Mobile.Text)
              .Parameters.AddWithValue("@contact_telno", txtContact_Tel.Text)
              .Parameters.AddWithValue("@homeadd_houseno", txtHomeAdd_HouseNo.Text)
              .Parameters.AddWithValue("@homeadd_street", txtHomeAdd_Street.Text)
              .Parameters.AddWithValue("@homeadd_brgy", txtHomeAdd_Brgy.Text)
              .Parameters.AddWithValue("@homeadd_town", txtHomeAdd_Town.Text)
              .Parameters.AddWithValue("@tersiary_schoolname", txtTersiary_Schoolname.Text)
              .Parameters.AddWithValue("@tersiary_address", txtTersiary_Add.Text)
              .Parameters.AddWithValue("@tersiary_degree", txtTersiary_Degree.Text)
              .Parameters.AddWithValue("@tersiary_batch", cbBatchTer.Text)
              .Parameters.AddWithValue("@secondary_schoolname", txtSecondary_Schoolname.Text)
              .Parameters.AddWithValue("@secondary_address", txtSecondary_Add.Text)
              .Parameters.AddWithValue("@secondary_batch", cbBatchSec.Text)
          End With
          dr = cmd.ExecuteReader
          MsgBox("Data Updated", vbInformation, "Successfully Update Record")
          conn.Close()
  
  
      Catch ex As MySqlException
          MessageBox.Show(ex.Message)
      Finally
          conn.Dispose()
          buttons("ResetButtons")
          DataGridView1.Enabled = True
      End Try
  End Sub
  </code></pre>
  
  <p>any help is appreciated. Thx in advance.</p>