Database Concurrency

Results 1 to 2 of 2

Thread: Database Concurrency

  1. #1
    HW Guest

    Default Database Concurrency

    I am designing a page that will allow multiple users to access a SQL Server database. An id number is generated for each form the users submit, but they can override it with their own number. If they use their own number, the default id number is saved in a hold table and will be reused as the next default id number. My problem is the concurrency issues of multiple users accessing the hold table. For example, if there is one number in the hold table, and 10 users log on, they will each draw the same default id number. Is there a property or method where I can use to check to status of a table in SQL Server, so that if it is in use by one user, I can avoid other users accessing the same table?

  2. #2
    Kurt Golding Guest

    Default RE: Database Concurrency

    In the case you are describing, you can add a Boolean attribute value in your ID lookup table, Set it too true until the condition that makes it available again is true. Also, you might try using the adOpenKeyset,adLockPessimistic options in the record set when you call, get, and set the Boolean value. That way no other user can access that record until the operation is done.<BR><BR>Another way to do this is to use stored procedures, one to get and lock the ID in question, and another to restore it. This is very similar to the above operation, but using the SQL Stored procedure is a bit faster, and the work to deal out the ID’s is handled by the DB server, this can avoid some network latency issues. So in this case, the Stored Procedure would return the ID as a record set, set the Boolean value and end. The Other Stored Procedure would restore the value to useable if applicable.<BR><BR>Hope That Helps<BR><BR>K. Golding<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts