Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with TRY...CATCH?
Message
De
16/07/2009 00:14:27
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Problem with TRY...CATCH?
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Divers
Thread ID:
01412651
Message ID:
01412651
Vues:
134
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.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform