Last post Oct 15, 2014 02:27 AM by Aswecan
Oct 14, 2014 04:26 AM|EssCee|LINK
I have a webpage accessed by multiple users, these users enter the info they have collected for the same record. At present if there are 5 questions user 1 and user 2 log in then the changes of the last user who clicked Save are saved overwriting the other
users answers, so if user 1 answers questions 1 and 2 and user 2 answers questions 3 and 4 then whoever clicks Save last overwrites the other users answers.
At present i use Linq to SQL to save and update records (InsertOnSubmit and SubmitChanges()) and wondered if anyone could advise the best way to approach this situation with some examples?
Oct 14, 2014 08:18 AM|Mikesdotnetting|LINK
If there is only one "correct" answer then it shouldn't matter if user 2 overwrites the answer provided by user 1. Otherwise you should find what you need form this big section on MSDN about managing change conflicts in L2S: http://msdn.microsoft.com/en-us/library/bb399389(v=vs.110).aspx
Oct 15, 2014 02:27 AM|Aswecan|LINK
As far as I Know, I recommend the following code.
catch (ChangeConflictException e)
foreach (ObjectChangeConflict occ in db.ChangeConflicts)
//No database values are merged into current.
For more information, please refer to the following.