|
-
Jun 20th, 2010, 09:58 PM
#1
Thread Starter
Addicted Member
Concurrent User Update
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.
-
Jun 20th, 2010, 11:55 PM
#2
Frenzied Member
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.
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 21st, 2010, 02:54 AM
#3
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
-
Jun 21st, 2010, 03:38 AM
#4
Re: Concurrent User Update
 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?
-
Jun 21st, 2010, 05:34 AM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|