If userA deleted OrderA while userB is modifying OrderA, then userB saves OrderA then there is no order in the database to be updated. My problem is there is no error! The SqlDataAdapter.Update succeeds and returns a “1” indicating a record was modified when this is not true. Does anybody know how this is supposed to work, thanks.
If userA deleted OrderA while userB is modifying OrderA, then userB saves OrderA then
Share
You need to use, at the very least, optimistic locking. See here:
Optimistic Locking
Basically, this says that you check the values of all fields during the update. So you say, for example assuming when you first read record 1, bar was equal to 0:
The idea is, if the record changes, the update will fail. This will solve your problem.