Microsoft KB Archive/151841

= PRB: FoxPro and Clipper Share the Same DBF Files on a Network =

Article ID: 151841

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.6 Standard Edition
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.6 for MS-DOS
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q151841



SYMPTOMS
RLOCK will not function properly when a FoxPro Application and a Clipper Application access the same table simultaneously.



CAUSE
Both FoxPro and Clipper have their own Locking Mechanism. When applying a lock to a table file on the Network, the function FLOCK can be recognized by both Foxpro and Clipper; it will return a TRUE (.T.) if the table is locked by any of the applications. The function RLOCK returns a TRUE only if a particular record of a table is locked by the same application. In other words, if a record was locked by Foxpro, Clipper can still lock the particular record without an error, and it has the same behavior the other way around.



RESOLUTION
Use FLOCK instead of RLOCK.



Steps to Reproduce Behavior
Run the following code in Clipper: **  is a numeric field in a Table

USE  SHARED GOTO TOP REPLACE  WITH 100  && Initial Value of 

DO WHILE RLOCK                && Record is Locked by Clipper ?  WAIT ‘Hit a Key ...’ TO M.temp ENDDO and Run the following code in FoxPro: USE  SHARED GOTO TOP

DO WHILE RLOCK                && Record is Locked by Foxpro REPLACE  WITH  + 1 WAIT ‘Hit a Key ...’ TO M.temp ENDDO

Expected Behavior
When the above code is executed by Foxpro and Clipper at the same time, the expected behavior is:


 * Clipper locks the record and displays the value of the field, which is 100.
 * Foxpro cannot lock the same record, so it will keep on trying to lock the record and will not be able to add 1 to the field.

Actual Behavior

 * Clipper locks the record and displays the value of the field, which is 100.
 * FoxPro locks the record successfully and adds 1 to the field.
 * Press a key on the Clipper machine, and it displays 101.
 * Press a key on the Foxpro machine, and it locks the record successfully again and adds one more to the field.
 * Press a key on the Clipper machine, and it displays 102.

Additional query words: FoxWin VFoxWin FoxDos

Keywords: kb3rdparty KB151841

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.