删除记录后,Access数据库不会更新

时间:2018-04-17 05:43:21

标签: vb.net

在我的简单应用程序中,我附加了一个访问数据库。在表格中有3个ADD,UPDATE& amp;按钮。删除。我的代码就是这个,

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

所有3个按钮分别正常工作。我添加了几条记录并进行了更新然后删除1条记录。然后试图更新。不幸的是无法它给出了一个错误,永远不会更新。错误是

并发冲突:UpdateCommand影响了预期的1条记录中的0条。

请告诉我如何解决这个烂摊子。谢谢!

0 个答案:

没有答案