Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Connection Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
SQL Connection Question
Divers
Thread ID:
00949397
Message ID:
00949397
Vues:
52
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform