What we can do is, in the DB table we can maintain the first record holder name and when other users tries to get the record we can check this column and notify/prevent him by throwing error.
Or we can try to implement some thing like versions in ORM technologies.
In the post, there are 2 posts which are marked as answer. I wanted to know, if I go the IsEdit=1 route, how do I know when a user has opened the record for editing but closed the session/browser etc. Also, what should the second user (user B) see when User
A is making any changes?
Should User B be shown a message such as "The record is being edited"?
csharpnew
Member
73 Points
71 Posts
How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 24, 2012 07:45 PM|LINK
Hello All,
I have a scenario where there may be multiple users editing the same record.
Each user can access few employee records from the database table. These records are seen in a gridview/formview.
When User A has touched the record for editing, I want to notify/prevent User B updating the record.Is there a way to do it?
I looked at this post but needed more clarification. http://forums.asp.net/t/1413577.aspx/1
Thanks,
net
vckreddyece
Member
215 Points
52 Posts
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 24, 2012 10:40 PM|LINK
What we can do is, in the DB table we can maintain the first record holder name and when other users tries to get the record we can check this column and notify/prevent him by throwing error.
Or we can try to implement some thing like versions in ORM technologies.
net
usman400
Contributor
3503 Points
721 Posts
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 25, 2012 04:53 AM|LINK
What u need it locking mechansim
search this forum or google, to get code for: how to lock and unlock SQL database or table
this way, your code will lock the DB, hence no new connection will be possible to DB
or no write access will be granted, until an already working user gets the task done
then u can unlock the database to make it available to other users.
Another way is using transactions, in that case, you dont need to notify other users, transactions complete
in logical manner i.e. either it will be completed or nothing will be done, this way, concurrent access is not a problem
nilsan
All-Star
16940 Points
3719 Posts
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 25, 2012 05:24 AM|LINK
What more clarification do you need?
net
Blog | Get your forum question answered | Microsoft Community Contributor 2011
csharpnew
Member
73 Points
71 Posts
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 27, 2012 03:04 PM|LINK
In the post, there are 2 posts which are marked as answer. I wanted to know, if I go the IsEdit=1 route, how do I know when a user has opened the record for editing but closed the session/browser etc. Also, what should the second user (user B) see when User A is making any changes?
Should User B be shown a message such as "The record is being edited"?
Hence, needed more clarification or ideas.
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 28, 2012 07:58 AM|LINK
Hi,
See how it works as below:
http://www.asp.net/web-forms/tutorials/data-access/accessing-the-database-directly-from-an-aspnet-page/implementing-optimistic-concurrency-with-the-sqldatasource-vb
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework
csharpnew
Member
73 Points
71 Posts
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 28, 2012 09:20 PM|LINK
Thanks for your reply.
I am looking into the article and checking to see whether I can do something similar in Oracle. If you find anything in Oracle, please pass it along.
Thanks again.
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 29, 2012 01:46 AM|LINK
Hi,
You can use SqlDataSource to connect the Oracle database:
http://msdn.microsoft.com/en-us/library/fkzs2t3h.aspx
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework
csharpnew
Member
73 Points
71 Posts
Re: How to use optimistic concurrency?- Prevent multiple users update the same record
Feb 29, 2012 11:53 PM|LINK
Hi,
I tried using the example that you sent. However, am facing an issue retreiving the old value of the field and rowupdated event not firing.
I have posted my question here- http://forums.asp.net/t/1775230.aspx/1?Get+oldValue+collection+from+Gridview+OnRowUpdating+event
Please let me know if you have any inputs.
Thanks again