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
Miscellaneous
Thread ID:
00949397
Message ID:
00949399
Views:
11
Kevin,

See Re: SqlStringConnection Message #884312

>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
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform