Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lock the DBF Header?
Message
From
13/11/1998 10:58:14
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00156987
Message ID:
00157412
Views:
23
>Is there a command in 2.6 equivalent to VFP RLOCK(0) to lock the header record. What we need is some way to lock the header to enable us to append data in a multi-user environment. In VFP, you can issue an RLOCK(0) where the parameter is the record number. If you issue this call in 2.6, it expects the work area as the parameter!
>
>We need to do this to enable us to have control over what to do if we cannot append the data to the file. Reprocess is not an answer, we have looked at that.
>
>Can anybody help???

Hi Nigel,

FWIW, I solved this problem in 2.0 by using the INSERT INTO command rather than the APPEND BLANK command. I first SCATTER MEMVAR BLANK then set all the memory variables which were created by that command to the values I want the new record to contain, and then I issue INSERT INTO (DBF()) FROM MEMVAR. This command does everything for you. It locks only the header, appends a new record, and gathers the variables into the new record, and then unlocks the header. Of course you have to handle the rare event when someone else has the header or the entire file locked which generates error 108, but that's not too difficult.

HTH
Sam
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform