There is a table called Accounts
that looks like this:
AccountID AccountName AccountTotalMoney
-------------------------------------------
1 Steven 600
3 Scott 800
But users can updates the row record at the same time like below now:
User A:UPDATE Accounts SET AccountTotalMoney=700 WHERE AccountID=1;
User B:UPDATE Accounts SET AccountTotalMoney=900 WHERE AccountID=1;
User C:UPDATE Accounts SET AccountTotalMoney=1000 WHERE AccountID=1;
.
.
.
So I would like to prevent multiple users updating the same record at the same time . Just one after another.
I am a newbie in this aspect. Sorry for my bad english. Thanks in advance!
There are a lot of possibilities.
[opinion: i think most web application do optimistic concurrency handling]:
A good tutorial on optimistic concurrency handling is found here: http://msdn.microsoft.com/en-us/library/bb404102.aspx
Small abstract:
Similarly, when two users are visiting a page, one user might be in the midst of updating a record when it is deleted by another user. Or, between when a user loads a page and when they click the Delete button, another user might have modified the contents of that record.
There are three concurrency-control strategies available:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With