Results 1 to 2 of 2

Thread: Locking records while in use

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    Locking records while in use

    Hey All

    Making a multi user application running off one central DB SQL2k
    Whats the best way to go about locking records when users read them, So that two records cant be shown to the same user allowing user 2 to override what user 1 done...

    Any Comments

    Using
    vb.net, MSSQL2kse Stored Procs
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196
    the RDBMS generally handles concurrency for you.

    But you can modify your SQL by including the NOWAIT keyword (think this is an Oracle specific feature though!). A popular ADO workaround is to write a value to a field in a table for the duration of a user operation and deny other users access to this row until the lock value is cleared (when a commit is complete). Dangerous if the first user bombs out though and doesn't get a chance to clear the field - the row remains locked until the a superuser can clear it manually.

    HOWEVER...

    You wouldn't really want to hide a row from a second user as this would present very dirty data. Remember the data is only as good as the most recent update.

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