I have two identical tables in Access (Customer & test). Customer contains information and Test does not. I want to pull information into datagridview1, transfer the records to datagridview2, then update that info into the Empty Test table.
I've copied my dt to dt1 and displayed that info in datagricview2. I am getting stuck when I delete a record from datagridview2 and run the update method with the info in my dt1 -- receiving a concurrency error :"Concurrency violation: the DeleteCommand affected 0 of the expected 1 records."
Any suggestions are greatly appreciated.
|   Public Class Form1Dim dt As New DataTable
 Dim dt1 As New DataTable
 Dim connStr As String = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = test.ACCDB"
 Private sqlStr1 = "SELECT * FROM Customer"
 Private sqlStr2 = "SELECT * FROM Test"
 Private Sub Load(...) Handles Button1.Click
 Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr1, connStr)
 dataAdapter.Fill(dt)
 DataGridView1.DataSource = dt
 End Sub
 Private Sub Move(...) Handles Button2.Click
 dt1 = dt.Copy
 DataGridView2.DataSource = dt1
 End Sub
 Private Sub Update(...) Handles Button3.Click
 Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr2, connStr)
 Dim commandbuilder As New OleDb.OleDbCommandBuilder(dataAdapter)
 dataAdapter.Update(dt1)
 End Sub
 End Class
 |