Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error Trapping
Message
 
À
13/06/2002 08:47:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00667873
Message ID:
00667920
Vues:
20
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform