Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dataset optimistic concurrency
- UPDATE Table1 Set Col1 = @NewCol1Value,
- Set Col2 = @NewCol2Value,
- Set Col3 = @NewCol3Value
- WHERE Col1 = @OldCol1Value AND
- Col2 = @OldCol2Value AND
- Col3 = @OldCol3Value
- class OptLockDataSet {
- DataSet _data;
- DateTime LastUpdate {
- return _data.Tables["ChangeTracker"][0][0];//just for example :)
- }
- }
- if(GetLastUpdateFromDB(_data) > LastUpdate ) {
- //This means that last update was changed because someone else
- //modified the data.
- //Show error to user and reload data from db.
- }
- update data set @col1 = @val1 where last_update = @last_update
Add Comment
Please, Sign In to add comment