Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clean up tables in a multiuser env.
Message
 
To
22/06/1998 04:50:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00110489
Message ID:
00110494
Views:
23
>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) that is triggered if the table could not be opened exclusively is open on an other station. The error that is generated is nr 108 if the table is in used on another station is 108 ... 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 exist (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 of one or another reason. Do not forget to RELEASE the variable if you do not need it anymore.

HTH,

Marc

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