title: Update datagridview and database vb.net
body: <p>i want to update my datagridview and also my database im new to vb and i dont know what im doing wrong can sombody help me?</p>
  
  <pre><code>Private Sub DataGridView_Booking_Update(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView_Booking.RowLeave
      Try
          con.Open()
          Using cmd As New SqlCommand("UPDATE Tbl_booking SET Omschrijving = @Omschrijving, Jaar = @Jaar, Opmerking = @Opmerking ,Sortnr = @Sortnr)", con)
              cmd.Parameters.Add("@Omschrijving", SqlDbType.VarChar)
              cmd.Parameters.Add("@Jaar", SqlDbType.Int)
              cmd.Parameters.Add("@Opmerking", SqlDbType.VarChar)
              cmd.Parameters.Add("@Sortnr", SqlDbType.Int)
              cmd.ExecuteNonQuery()
  
          End Using
      Catch ex As Exception
          MessageBox.Show("Error while updating record on table..." &amp; ex.Message, "Update Records")
      Finally
          con.Close()
      End Try
  </code></pre>