Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking if table in use
Message
 
À
10/10/2004 04:48:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00950216
Message ID:
00950245
Vues:
12
>I don't want to get error message if the table used!

Use the Try-Catch in a method and return succes.


Something like
 PROCEDURE OpenExclusive(tcAlias as String) as Boolean
local llRetVal

llRetVal = .T.

if used(tcAlias)
    select (tcAlias)

else
    select 0

endif


TRY
    use (tcAlias) exclusive

CATCH
    *-- nope!
    llRetVal = .F.

ENDTRY

return llRetVal
ENDPROC
then You can call it
if OpenExclusive("Test")
   *-- do my exclusive stuff
else
   *-- display a message or do something different
endif
Oh, and if You do not Have VFP 8+ You'll need to do something like this instead of the try..catch
*-- disable the ErrorHandler
lcWasError = on("ERROR")
on ERROR *

....

use (tcAlias) exclusive

llRetVal = used(tcAlias)

*-- and reEnable the ErrorHandler
on error &lcWasError
HTH
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform