Order of Insert and Delete operations
Posted: Mon 17 Mar 2014 14:20
Hi,
there is a form where the user can manage records from a data table in a grid. When the user clicks on OK, I call DataContext.SubmitChanges.
The problem is that the user deletes a record, then adds another one with the same unique key (not the primary key). In this case we will have two operations: a delete and an insert.
When I call DataContext.SubmitChanges, the engine executes the insert operation first, and it causes a UK violation error. If it had executed the delete first, then everything would be fine.
Is there away to determine the order of the operations?
Thanks for your help,
Zoltan
there is a form where the user can manage records from a data table in a grid. When the user clicks on OK, I call DataContext.SubmitChanges.
The problem is that the user deletes a record, then adds another one with the same unique key (not the primary key). In this case we will have two operations: a delete and an insert.
When I call DataContext.SubmitChanges, the engine executes the insert operation first, and it causes a UK violation error. If it had executed the delete first, then everything would be fine.
Is there away to determine the order of the operations?
Thanks for your help,
Zoltan