Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I check if a dbf is already open?
Message
De
12/03/2016 03:23:00
 
 
À
11/03/2016 14:54:48
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01632847
Message ID:
01632901
Vues:
57
>>>>>How do I check if a dbf is already open?
>>>>
>>>>Do you mean by the current user, or by other users? For the current user, see Used() and Aused() in help. For other users, try to open the dbf exclusive.
>>>
>>>Thanks
>>
>>You're welcome.
>>
>>Update: While Used() can tell you if a dbf is open or not, Select() can tell you in which work area it's open, 0 means that it's not open. Unless you use Alias, that is.
>
>USED() and AUSED only in current datasession. If you work with multiple datasessions you need to check any datasession in ASESSIONS() with AUSED() like
>
Which is why I referred to Help. :-)

>USE E:\SE\tmp\ut\xyz.DBF ALIAS baeh
>
>?Is_DBF_Used('baeh')  && .F.
>?Is_DBF_Used('xy')  && .F.
>?Is_DBF_Used('xyz.DBF')  && .F.
>?Is_DBF_Used('E:\SE\tmp\ut\xyz.DBF')  && .T.
>
>FUNCTION Is_DBF_Used
> LPARAMETERS;
>  lcDBF
>
> LOCAL;
>  lnSession AS INTEGER,;
>  llUsed    AS BOOLEAN
>
> LOCAL ARRAY;
>  laSessions(1,1),;
>  laUsed(1,1))
>
> FOR  lnSession = 1 TO ASESSIONS(laSessions)
>  llUsed = AUSED(laUsed,lnSession,lcDBF)>0
>  IF llUsed THEN
>   EXIT
>  ENDIF &&llUsed
> ENDFOR &&lnSession
>
> RETURN llUsed
>ENDFUNC &&Is_DBF_Used
>
>
>:)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform