Access database doesn't update after deleting a record
In my simple application, I have attached a access database. In the form there are 3 buttons for ADD,UPDATE & DELETE. My code is this,
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'NamesDataSet.Table6' table. You can move, or remove it, as needed. Me.Table6TableAdapter.Fill(Me.NamesDataSet.Table6) End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Save.Click Table6BindingSource.EndEdit() Table6TableAdapter.Update(NamesDataSet.Table6) End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Add.Click Table6BindingSource.AddNew() End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Delete.Click Table6BindingSource.RemoveCurrent() End Sub End Class
All 3 buttons works fine separately. i added several records and updated. then delete 1 record. then tried to update. Unfortunately unable. It gives an error and never update. the error is
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
Please tell me how to solve this mess.Thanks!