Hi!

I use this code to copy a row in a DataTable bound by a BindingSource to a DataGridView:
Code:
Dim oldRowCopy As DataRow
'Create new row
oldRowCopy = myDataTable.NewRow()
'copy values
oldRowCopy.ItemArray = myDataTable.Rows(indexOfTheRowIWantToCopy).ItemArray
'mark the original row as copied
myDataTable.Rows(newMainGrid2.CurrentRow.Index).Item("wasCopied") = True
myDataTable.Rows(newMainGrid2.CurrentRow.Index).Item("record_state") = "UPDATED"
'Change some values in the copy of the original row
oldRowCopy("id") = DBNull.Value
oldRowCopy("date_time") = Now()
oldRowCopy("record_state") = "NEW"
myDataTable.Rows.Add(oldRowCopy)
The DataTable gets filled and updated by an OleDbDataAdapter, where the Insert, Update and Delete Commands are set by an OleDbCommandBuilder.
Then later, when the user has finished editing the copied row, I call
Code:
myDataAdapter.Update(myDataTable)
, to save the changes to the database.
Now, this row copying throws an OleDb Concurrency Exception saying that 0 rows affected.
I wonder, if this approach of copying the row is wrong.