Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error Trapping
Message
 
To
13/06/2002 08:47:46
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00667873
Message ID:
00667920
Views:
21
>How do you trap an error generated by SQL server in Visual Foxpro 6.0 when there is a problem connecting to SQL server so Foxpro error handling routine will catch it before SQL throws a message box on the user's machine with an error. For example, Connection Failed because of SQL Server Error 18456 or Error 4060. Help please.....

Try this
LOCAL lnH
LOCAL ARRAY laErr[1]

lnH = 0
*-- don't show ODBC window dialog login
SQLSETPROP(lnH,'DispLogin',3)  
lnH = SQLCONNECT("myDriver","myUsername","myPassword")
IF lnH < 0
	AERROR(laErr)
	MESSAGEBOX(laErr[3],16,"Database connection fails")
ELSE
	MESSAGEBOX("Database connection Ok",64,"Ok")
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform