Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with TRY...CATCH?
Message
 
 
À
16/07/2009 00:14:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Divers
Thread ID:
01412651
Message ID:
01412657
Vues:
53
BTW, do you need to use TEXTMERGE to write to the log file? Can you use strtofile() instead?

>I've got a simple method, CanOpen() which tests if a passed .dbf file name can actually be opened (i.e. it's not corrupted, etc.) The former version used ON ERROR and worked fine, but I've decided to update it to use TRY...CATCH instead.
>
>LPARAMETERS ;
>	tcConfigFile
>
>LOCAL ;
>	llRetVal
>
>llRetVal = .T.
>
>TRY
>	USE ( tcConfigFile ) ALIAS Config IN 0 EXCLUSIVE
>
>CATCH
>	llRetVal = .F.
>
>ENDTRY
>
>IF USED( "Config" )
>	USE IN Config
>
>ENDIF
>
>RETURN llRetVal
>
>In testing, this code *seems* to return the correct value, but I'm getting some side effects. I have a log file open with SET TEXTMERGE TO ..., and after this code runs messages no longer get written to the log file.
>
>I haven't used TRY...CATCH much, maybe I've got the syntax completely wrong.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform