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