Results 1 to 5 of 5

Thread: Concurrent User Update

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Posts
    166

    Exclamation 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.

  2. #2
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    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

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  4. #4
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Concurrent User Update

    Quote Originally Posted by hoobas20 View Post
    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?
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  5. #5
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    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
  •  



Click Here to Expand Forum to Full Width