Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBUSED(lcName) returns .F. but cannot OPEN DATABASE (lcN
Message
De
22/11/2000 18:00:04
 
 
À
22/11/2000 17:38:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00444781
Message ID:
00444822
Vues:
8
>Thanks for the answers Trey.
>
>>Either it got used as a table
>>or is open in another data session
>>or it's being used by someone else on the network
>>or a com server has it open, in which case you won't be able to see it open.


>Yes, the DBC was open as a file in datasession 1. I consulted it and forgot to close it. oops!

Yay, I'm not the only one! <g>


>
>
>>Just USED("PL") - you're only checking an alias name
>>I would use:
>>If Used("pl") And JustFName(DBF("pl"))="PL.DBC"
>>JustFName being in FoxTools < VFP6
>>Since it's checking an alias, USED() only works in the current data session.
>I didn't know that USED only works in current data session, because it uses alias.

Sorry about that. That was actually a mix of 2 sentences that shouldn't have gone together. I accidentally cut some of the "Since..." one. It was supposed to be:

Since it's checking an alias, USED() won't tell you the actual table name so you still probably need DBF() to get that.
USED() only works in the current datasession.


>>I am not sure I understand your suggestion. How does one find out if a file "xx.yy" is being used in another data session? I guess normally it doesn't matter, but in this case it does.

Loop through all open datasessions - to easily find the highest open datasession, create a session object and get it's datasessionid. Start from 1 less e.g.
oSession = Createobject("session")
lnDSHigh = oSession.DataSessionID-1
For ji = lnDSHigh To 1 Step -1
  Set Datasession To (ji)
   If Used("pl")
     Use in pl
   Endif
EndFor
You might want to put some error checking on the SET DATASESSION.


>
>
>>Can you not manually pick it from the viewer? I wasn't sure if you were only doing this is code.
>>You could suspend and ACTIVATE WINDOW standard to pull up the standard toolbar and check the databases in use from the database combo.
>I tried picking it from the viewer but it refuses to change to datasession 1.
>
>Thanks a lot.
>
>Alex
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform