ASP.NET, SQL Record Locking

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Sm9obiBXYWxrZXI=?=

    ASP.NET, SQL Record Locking

    Hi.
    Is there a convenient way to lock SQL records so that two users cannot
    attempt to update the same row, thereby preventing users from overwriting
    other user's data?
    For example, we have a asp.net 2.0 application which allows a user to pull
    up customer information, modify their information and save it back to the
    database. if there is a different user attempting to pull up that same
    customer record while the other user is viewing it in their browser we would
    like to display a message "the customer record you are trying to access is
    currently locked by another user."
    We may also want to give each user a certain amount of time to have a record
    locked before releasing it for access by other users.
    Any advice would be appreciated.
    Thanks!
    John


  • sloan

    #2
    Re: ASP.NET, SQL Record Locking

    I would say most go with an optimistic locking strategy.




    "John Walker" <JohnWalker@dis cussions.micros oft.comwrote in message
    news:8328B362-F2B8-45DE-8042-C4CACBD2883F@mi crosoft.com...
    Hi.
    Is there a convenient way to lock SQL records so that two users cannot
    attempt to update the same row, thereby preventing users from overwriting
    other user's data?
    For example, we have a asp.net 2.0 application which allows a user to pull
    up customer information, modify their information and save it back to the
    database. if there is a different user attempting to pull up that same
    customer record while the other user is viewing it in their browser we
    would
    like to display a message "the customer record you are trying to access is
    currently locked by another user."
    We may also want to give each user a certain amount of time to have a
    record
    locked before releasing it for access by other users.
    Any advice would be appreciated.
    Thanks!
    John
    >
    >

    Comment

    • =?Utf-8?B?Sm9obiBXYWxrZXI=?=

      #3
      Re: ASP.NET, SQL Record Locking

      That may be what i need.
      Thank you!

      "sloan" wrote:
      I would say most go with an optimistic locking strategy.
      >

      >
      >
      "John Walker" <JohnWalker@dis cussions.micros oft.comwrote in message
      news:8328B362-F2B8-45DE-8042-C4CACBD2883F@mi crosoft.com...
      Hi.
      Is there a convenient way to lock SQL records so that two users cannot
      attempt to update the same row, thereby preventing users from overwriting
      other user's data?
      For example, we have a asp.net 2.0 application which allows a user to pull
      up customer information, modify their information and save it back to the
      database. if there is a different user attempting to pull up that same
      customer record while the other user is viewing it in their browser we
      would
      like to display a message "the customer record you are trying to access is
      currently locked by another user."
      We may also want to give each user a certain amount of time to have a
      record
      locked before releasing it for access by other users.
      Any advice would be appreciated.
      Thanks!
      John
      >
      >
      >

      Comment

      • sloan

        #4
        Re: ASP.NET, SQL Record Locking


        As a followup, I now convert the timestamp/rowversion column to a bigint
        when I pull it up to the webpage.

        I've seen some other tricks, but that one works for me.

        Select EmpID, convert(bigint, MyTimeStampColu mn) as
        MyTimeStampColu mnAsBigInt, LastName, FirstName from dbo.Employee

        something like that.



        "John Walker" <JohnWalker@dis cussions.micros oft.comwrote in message
        news:8B4B31EB-52CF-4343-9339-082FC645A53B@mi crosoft.com...
        That may be what i need.
        Thank you!
        >
        "sloan" wrote:
        >
        >I would say most go with an optimistic locking strategy.
        >>
        >http://www.google.com/search?hl=en&q...tic+locking%22
        >>
        >>
        >"John Walker" <JohnWalker@dis cussions.micros oft.comwrote in message
        >news:8328B36 2-F2B8-45DE-8042-C4CACBD2883F@mi crosoft.com...
        Hi.
        Is there a convenient way to lock SQL records so that two users cannot
        attempt to update the same row, thereby preventing users from
        overwriting
        other user's data?
        For example, we have a asp.net 2.0 application which allows a user to
        pull
        up customer information, modify their information and save it back to
        the
        database. if there is a different user attempting to pull up that same
        customer record while the other user is viewing it in their browser we
        would
        like to display a message "the customer record you are trying to access
        is
        currently locked by another user."
        We may also want to give each user a certain amount of time to have a
        record
        locked before releasing it for access by other users.
        Any advice would be appreciated.
        Thanks!
        John
        >
        >
        >>
        >>
        >>

        Comment

        Working...