Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check to see if a table on a network drive is in use
Message
De
10/06/2003 10:50:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
10/06/2003 10:47:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00798363
Message ID:
00798393
Vues:
32
>Is there a way I can check if a file is open before trying to open it using the USE command?
>
>e.g.
>
>IF ALREADYOPEN("mytable")
> =MESSAGEBOX("Mytable is already open by another user",48,"")
>ELSE
> USE mytable IN 0 ALIAS mytable
>ENDIF
>
>ALREADYOPEN being a purely fictional command.

I think it is easier to check "after you open it", that is, use error handling. For instance:
local llFileError
ON ERROR llFileError = .T.
use MyTable
ON ERROR
if llFileError
  MessageBox("Can't open table.")
else
  (Continue processing)
endif
This has to be adjusted if you already have an error handler for your application (save your "on error" and restore it later).

Or, of you have VFP8, better use TRY...CATCH (see this month's issue of the Universal Thread Magazine).

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform