Results 1 to 7 of 7

Thread: MS-SQL table access [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147

    MS-SQL table access [RESOLVED]

    My App works with an MS SQL DB; the DB is manipulated (Updates, Inserts, Deletes) by a number of applications so I need a away of detecting whether a table is locked, and if it is waiting and retrying.

    Any ideas would be welcome.
    Last edited by mik706; Jan 20th, 2004 at 03:11 AM.
    Mik706

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Hi there,
    My suggestion to you is lookup the underlying value property of the ADO recordset to find out if someone has changed anything.

    Cheers,
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147
    I am not looking to see if the table has changed.

    If another application has locked the table and I try and lock the table an error is generated because I cannot open the table exclusively. I would like to know the best way to trap this error.
    Mik706

  4. #4
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Ok. Do an On Error Resume Next before using the table. Check for the error code. If it contains a number, it indicates that the table is locked. You will have some specific error code for locked tables.

    Cheers,
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147
    i am currently using an On Error Resume Next statment but i was wondering if ther was a better way of doing it. ie a specific test that can be performed to find the state of a table.
    Mik706

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I don't think so. You have to check for the error being raised, and handle it.

  7. #7
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Just a question folks, how do you simulate a locked table in MS ACCESS?

    Cheers,
    Abhijit

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