Options

How to check if table is locked or not.

rahul_jnkrahul_jnk Member Posts: 61
Dear All,

Is there a way to find whether a table is locked before doing any update operation on it?

For eg before I go on updating the records in the Table MyREC, I would like to know before hand whether the table is locked or not

IF MyREC.FINDSET(TRUE, FALSE) THEN REPEAT
......
UNTIL MyREC.NEXT = 0

Thanks.

Answers

  • Options
    JJMcJJMc Member Posts: 59
    Try to lock it yourself, if you get an error, then you can't. If you lock the table in a try function, you can catch the error to avoid to stop the process
  • Options
    rahul_jnkrahul_jnk Member Posts: 61
    Thank You @JJMc
    That was what I did eventually. But I thought there could be a better way.
  • Options
    ktwoonektwoone Member Posts: 4
    @JJMc @rahul_jnk Can you please elaborate how you used Try Function to identify the lock table issue?
  • Options
    JJMcJJMc Member Posts: 59
    edited 2021-07-07
    Write a Try function, and lock the table inside this funtion (procedure) like this TableX.Locktable(false).
    If this function manages to lock the table, it'll return true, otherwise it'll return false. Then you can catch the error and do whatever you need to do.
Sign In or Register to comment.