[Background]
I have a DataGridView bound to an MS Access table. This is a single-
user application. When the User is adding or editing a row, the User
may click on a Control elsewhere. That Control has context which I use
to programmatically set *other* r/o cell values for the currently
selected grid row. So, after that click on another control, and
stuffing the related cell values, I want to seamlessly allow the user
to resume editing/adding that row as though its focus was never
interrupted (by the click on the other Control).
This works (out of the box, no special coding) except in the case
where the table is empty such that the selected row being edited is a
*new* row AND the *first* row. In that single case, I get a
"Concurrency Violation: the UpdateCommand affected 0 of the expected 1
records."
I first tried adding what seemed rational approaches such as setting
the row dirty and/or setting Optimistic Locking off on the DataSet and/
or ending the AddNew mode and switching to Edit mode. This quickly
devolved into trying every permutaion of intevening API calls
imaginable to get the row/cell/dataset/etc. into a state that didn't
generate the exception. Every attempt spawns other issues...
[The Question]
Is there a prescribed approach to setting cell values prgrammatically,
particularly for the first row when that row is a new row - where the
exception is thrown?