Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. restricting a user from accessing the same records from a table which an application is updating

restricting a user from accessing the same records from a table which an application is updating

Scheduled Pinned Locked Moved Database
databasequestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sanjubaba
    wrote on last edited by
    #1

    Hi, I have an application where i am selecting some records and updating and giving it back to the database. Now while i am updating these records, if another user is accessing the same table and same records, i want to restrict him to these records. Eg.. If i have selected some records with sr no. 1,2,3,4,5 and currently in a process in updating these records in an application, then i dont want these records to be updated or used by some other user at the same time. Is it possible??

    Sandeep Kumbhar

    J W A D 4 Replies Last reply
    0
    • S sanjubaba

      Hi, I have an application where i am selecting some records and updating and giving it back to the database. Now while i am updating these records, if another user is accessing the same table and same records, i want to restrict him to these records. Eg.. If i have selected some records with sr no. 1,2,3,4,5 and currently in a process in updating these records in an application, then i dont want these records to be updated or used by some other user at the same time. Is it possible??

      Sandeep Kumbhar

      J Offline
      J Offline
      Justin The
      wrote on last edited by
      #2

      can you add a new column in the table which flag if it is being accessed ? and if it is then deny any other request to it. so before updating the data, it will check if the flag is up or down. if it's down, change it to up and modify the data, commit, then change the flag to down. if the flag is up, then do nothing or show a message

      1 Reply Last reply
      0
      • S sanjubaba

        Hi, I have an application where i am selecting some records and updating and giving it back to the database. Now while i am updating these records, if another user is accessing the same table and same records, i want to restrict him to these records. Eg.. If i have selected some records with sr no. 1,2,3,4,5 and currently in a process in updating these records in an application, then i dont want these records to be updated or used by some other user at the same time. Is it possible??

        Sandeep Kumbhar

        W Offline
        W Offline
        Willem Ten Broek
        wrote on last edited by
        #3

        i read somewhere that you can control record locking using different isolation levels :~

        1 Reply Last reply
        0
        • S sanjubaba

          Hi, I have an application where i am selecting some records and updating and giving it back to the database. Now while i am updating these records, if another user is accessing the same table and same records, i want to restrict him to these records. Eg.. If i have selected some records with sr no. 1,2,3,4,5 and currently in a process in updating these records in an application, then i dont want these records to be updated or used by some other user at the same time. Is it possible??

          Sandeep Kumbhar

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          By default, while the update is actually taking place nobody will have access to the record - that is known as a dirty read. I suspect what you actually are trying to describe is have user A and user A read the data, user A updates it and then user B updates it, losing user A's changes. This is a common scenario, frequently resolved by using either a timestamp column or a sequence number on the record which is checked before the update is done - if its changed then do not update. Hope this helps

          Bob Ashfield Consultants Ltd

          1 Reply Last reply
          0
          • S sanjubaba

            Hi, I have an application where i am selecting some records and updating and giving it back to the database. Now while i am updating these records, if another user is accessing the same table and same records, i want to restrict him to these records. Eg.. If i have selected some records with sr no. 1,2,3,4,5 and currently in a process in updating these records in an application, then i dont want these records to be updated or used by some other user at the same time. Is it possible??

            Sandeep Kumbhar

            D Offline
            D Offline
            David Mujica
            wrote on last edited by
            #5

            You can build your own locking strategy with a stored procedure supplied by Microsoft. Check these references out .. http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/06/30/855.aspx[^] http://msdn.microsoft.com/en-us/library/ms189823.aspx[^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups