Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Connection Question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL Connection Question
Miscellaneous
Thread ID:
00949397
Message ID:
00949397
Views:
51
How do I keep the SQL Connection error message from coming
up if a connection fails?

The ON ERROR in this code doesnt prevent the message from
showing.
CLEAR
CLOSE DATABASES ALL

LOCAL nHandle, cString, nResult, aErrors[1], lError

** Connect to the Pubs DB
ON ERROR lError = .T.

cString = "DSN=northwind;uid=username;pwd=password;database=pubs"
nHandle = SQLSTRINGCONNECT(cString)

ON ERROR 

IF nHandle > 0

	** Get all author records from california
	nResult = SQLEXEC(nHandle, "select * from authors where state = 'CA'", "authors")

	** Disconnect
	=SQLDISCONNECT(nHandle)

ELSE

	? "Failed to connect"

	=AERROR(aErrors)
	MESSAGEBOX(aErrors[2],16, "Connection Error")
	
ENDIF
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform