This is what I have and it does not stop concurrency error. Loosely
based on MSDN article about concurrency error. The primary Key is
updated. Calling Fill again will not work because I get foreign key
problems so I cannot clear the values. If I do not clear the values I
get duplicated rows.
Help this one has had be stuck for a long time.
tblBallTableAdapter.Adapter.RowUpdated += InsertGeneric;
private void InsertGeneric(object sender,
System.Data.OleDb.OleDbRowUpdatedEventArgs args)
{
if (args.StatementType == StatementType.Insert)
{
// Include a variable and a command to retrieve the
// identity value from the Access database.
int newID = 0;
OleDbCommand idCMD = new OleDbCommand("SELECT @@IDENTITY",
args.Command.Connection);
// Retrieve the identity value and store it in the CategoryID
column.
newID = (int)idCMD.ExecuteScalar();
args.Row["ID"] = newID;
DataTable changes = args.Row.Table.GetChanges();
args.Row.Table.Merge(changes);
args.Row.Table.AcceptChanges();
idCMD.Dispose();
args.Status = UpdateStatus.SkipCurrentRow;
}
}