Microsoft KB Archive/188064

= PRB: ISRLOCKED and ISFLOCKED Return Incorrect Values =

Article ID: 188064

Article Last Modified on 12/11/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q188064



SYMPTOMS
When an instance of Visual FoxPro locks a record or a table, calling the ISRLOCKED or ISFLOCKED functions on another computer or another instance of Visual FoxPro returns false.



RESOLUTION
Test the lock status using RLOCK or FLOCK instead. ISRLOCKED and ISFLOCKED only indicate whether the record or file is locked by the instance of Visual FoxPro from which they are called. If these functions were to test for the record and file locks of other users, the lock status could quickly change. This would make the information returned by ISRLOCKED and ISFLOCKED unreliable.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
  Save the following code in a program and run the program: *-- Code begins here. CREATE TABLE locktest (field1 C(10)) CLOSE DATA USE locktest SHARED INSERT INTO locktest (field1) VALUES ("A test") GOTO 1 =RLOCK *-- Code ends here.   On another computer or in another instance of Visual FoxPro, save the following code in a program and run the program: *-- Code begins here. USE locktest SHARED GOTO 1 IF ISRLOCKED WAIT WINDOW "Record is locked." ELSE WAIT WINDOW "Record is not locked." =RLOCK && Should get the "Attempting to lock..." in status bar ENDIF *-- Code ends here. If you run the program from another computer, please map a drive to the first computer containing the Locktest table. 

After you run the second program the Wait Window appears. Press any key and the "Attempting to lock..." message appears in the status bar.

