Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    Bangalore
    Posts
    1

    Unanswered: record locking on select

    i am selecting a record from the table.i want to lock that recordset when i select that particular record so that another user should not be able to modify that record.using ADO if am right locking is done during edit and update.can any one help me with locking during the select itself

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    To hold any locks you need to have an open transaction.
    Something like

    begin tran
    select * from tbl (tablockx, holdlock)

    This will lock the table exclusively until the transaction is terminated.
    To hold the transaction open it must be created on the spid by the application rather than in the stored procedure.

    For your requirement you are probably better off having a separate table in with yuo hold the IDs of the record that the user is wanting to update and forcing the read for update SP to update this table.

Posting Permissions

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