Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I check if a dbf is already open?
Message
De
11/03/2016 14:54:48
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
11/03/2016 08:22:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01632847
Message ID:
01632876
Vues:
55
>>>>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
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
:)
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform