Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clean up tables in a multiuser env.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00110489
Message ID:
00110496
Views:
21
Ehhr, corrected version :)

>>Hi All!
>>
>>What is the best way to pack a table in a multiuser env?
>>Is there any way to detect if a table is open by other users.
>>I need to do some cleanup when the program is terminated, if
>>the table is not in use.
>>
>>
>>Best regards
>>
>>Per Simmersholm
>
>Per,
>
>I simply open the table exclusively (USE ... EXCLU) and trap the error (ON ERROR). The error that is generated is nr 108 if the table is in use on another station ... most of the time.

The easiest is to create and set a private variable (say to 0) just before you open the file, let your error handler set the variable (say to 1) if it exists (use TYPE()) and test the variable after the opening sequence. If it is still 0, then you opened your file exclusively, otherwise, the opening instruction failed for one or another reason. Do not forget to RELEASE the variable if you do not need it anymore.
>
>HTH,
>
>Marc

... and Vladimir, one could use FLock of course ... :)

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform