Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Obtaining ODBC errors.
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00505654
Message ID:
00505695
Views:
16
>Does anyone know how to get the actual error message from an ODBC driver?
>What I mean is when executing a SQLEXEC command from Fox, you either get a 1 or a -1. That's fine and dandy, but if it's a -1 I would like to know WHY my SQLEXEC failed. BTW, I don't want to use the Tracing feature from the ODBC administrator because that could create some really big logs. All I want to do is grab the error and pop it up on the screen so the user knows there was an error and can call support( i.e. ME ) and read off the exact error being returned by the ODBC driver.
>Thank you

You can use AERROR function as shown in sample code below
LOCAL ARRAY laError[1]
LOCAL lcErrMsg

=AERROR(laError)
IF laError[1,1] <> 1526
	* It's not ODBC Error
	lcErrMsg = "VFP ERROR: " + Transform(laError[1,1]) + ;
				" " + Transform(laError[1,2])
ELSE
	lcErrMsg = ALLTRIM( laError[1,3] )
ENDIF	
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform