Error updating MySQL Table from DataGridView in VB.NET

0

I try to update a table of my database in MySQL from a DataGridView in my VB.NET project but I get the following error:

concurrency violation the updatecommand affected 0 of the expected 1 records.

The code I have is the following:

Private Sub btnUpdateServices_Click(sender As Object, e As EventArgs) Handles btnUpdateServices.Click
    If cbxEmployee.Text = "" Then
        MsgBox("You must select a person in charge of health care giver.")
    Else
        InsertarHCG()

        Dim MyBuilder As MySql.Data.MySqlClient.MySqlCommandBuilder
        MyBuilder = New MySql.Data.MySqlClient.MySqlCommandBuilder(connect.cur_da)
        dgvServicePlan.EndEdit()

        Try
            connect.cur_da.Update(dt)
            clsLogger.logEvent("Changes in the service plan successful.")
            MessageBox.Show("Service plan successfully updated.")
        Catch ex As Exception
            MessageBox.Show("Could not update the service plan.")
        End Try

        Me.Close()
    End If
    
asked by Jose Dario Correa 18.05.2016 в 18:27
source

1 answer

0

Depending on the problem you place, it may be because you want to do an Update of a table that does not have a Primary Key (it does not have a Primary Key).

Without Password, the Update command of the MySQL Adapter can not be generated.

    
answered by 05.08.2016 в 22:50