Re: Concurrent User Update
hey,
I never done something like this before
but as an idea, i don't know if the others will approve it or not
create a static class with static public fields (boolean) EditRowFlag
and check the value of it was true for example then there is someone Editing this Row right now.
Re: Concurrent User Update
You should take a look at this article either:
http://msdn.microsoft.com/en-us/library/cc917674.aspx
There are various ways of implementing concurrency, either at the database level, or in code.
Gary
Re: Concurrent User Update
Quote:
Originally Posted by
hoobas20
Hello Guys,
I'm having problem on how will i restrict the user to edit certain records if it is being used by another user.
Scenario :
Person A currently editing Customers table having CustomerID(pk) of 1
Person B also wants to edit the same record (CustomerID(pk) of 1)
In this case, my web app should prompt the Person B that "It is being use by another person" or prompt him to try again later.
By the way, Im using MSSQL 2008 R2 C#.NET 4.0 and asp.net 4.0.
Thanks.
Since this is ASP.NET and the browser and server are disconnected after each request, I wonder what will happen if Person A requests a record, but never returns back? Will you keep waiting for ever? :rolleyes:
Re: Concurrent User Update
Here is a good article on concurrency in asp.net
http://www.15seconds.com/issue/030604.htm
You can also do it very simply by adding datetime field (say called lockedDate) to tables enforcing concurrency and when the asp page that does the editing loads test that lockedDate is not within say 10 minutes of "now" (enough time to do an edit) if it is then another user is editing else it's open to being edited. You also need to stop a user updating after 10 minutes if they had the lock but that can be done in code on the page easy enough.
The best method is really dictated by your apps requirements