Information générale
Titre:
Letting calling program handle error messages.
Hello Group,
I am trying to use a class to make my connections to a SQL 7.0 database.
I would like to suppress the error messages from the class and let the calling program handle the error.
I would also like to suppress the logon screen that pops up when a logon fails.
The code for my class is:
lcConnect= "DRIVER={SQL Server};Server=" + lcServer + ";UID=" + lcUserID + ";PWD=" + lcPassword + ";Network=DBMSSOCN;" + "DATABASE=" + lcDatabase + ";"
lnHandle = SQLSTRINGCONNECT(lcConnect)
* Suppress ODBC error dialog
IF SQLGETPROP(0,'DispWarnings')
= SQLSETPROP(0,'DispWarnings',.F.) && No errors
ENDIF
*!* *You can also suppres login dialog if needed
IF SQLGETPROP(0,'DispLogin') <> 3
= SQLSETPROP(0,'DispLogin',3) && No login -- error on fail
ENDIF
IF lnHandle < 1 then
MESSAGEBOX("Connection Failed")
RETURN 0
ELSE
RETURN lnHandle
ENDIF
ON ERROR
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement