Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try...Catch...Finally
Message
 
To
30/05/2003 20:10:16
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00794807
Message ID:
00794989
Views:
14
>I just start to look at how Try...Catch...Finally works. Based on what I have read and tried, this mechanism won't handle (catch) ODBC error. Am I right or wrong?

Right. But you can wrap your ODBC Calls in a function call:
Try 
	=MySqlConnect("MyDsn")
Catch
	*-- Do whatever...
EndTry

Function MySqlConnect( cDSN As String ) As Integer

	Local lnHandle, loErr
	Local Array laError(1)
	lnHandle = -1

	Try
	
		lnHandle = SQLConnect(cDSN) 
		If lnHandle <=0 
			=AError(laError)
			Throw laError(1,2)
		Endif
			
	Catch To loErr
		Throw "Error...."
	
	EndTry
	
	Return lnHandle

EndFunc
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform