Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine if a table is open
Message
De
21/01/2002 17:28:18
 
 
À
21/01/2002 16:56:43
Stephen Hunt
Admit Computer Services Inc.
Farmingdale, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00607916
Message ID:
00608052
Vues:
33
Hello Stephen,

fopen() is reliable, but not for this. You had me scrambling for my Hacker's Guide *grin*. They are speaking about it not being reliable for opening devices such as COM1 or LPT1.

fopen() is not reliable for your situation because someone else may open the file after you try to open it with fopen(). Here is sample code that does what Craig and Al have already suggested to you:
local llOpenError, lcOldError

llOpenError = .f.
if !used('sometable')
    lcOldError = on("error")
    on error llOpenError = .t.
    use sometable in 0 exclusive
    if llOpenError
        * unable to open table exclusively
    else
        * table opened exclusively
    endif
    on error lcOldError
endif
>I tried the FOPEN() & FCLOSE() functions and go random results. Then I found a statement in the hackers guide to VFP that said the FOPEN() command is less then 100 % predictable when running on win 98 or NT, they recommended using api calls instead of FOPEN().
>
>Any other ideas I could try ?
>
>Thanks for all your help !
>Stephen J. Hunt
Steve Gibson
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform