Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clean up tables in a multiuser env.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00110489
Message ID:
00110496
Vues:
20
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform