der_bell
asked on
How to catch ODBC failure ?
I am using an ODBC connection to an SQL Server Database in my MFC app (VC++ 5.0 Enterprise). My program is running overnight, so it has to operate totally unattended. I need a way of trapping the error if the SQL DB is down and writing an error message to my app's log file.
How and where can I test if the ODBC connection was successful or failed ? In other words, where to test the result of the GetDefaultConnect procedure ?
Thanks a lot,
Derek
How and where can I test if the ODBC connection was successful or failed ? In other words, where to test the result of the GetDefaultConnect procedure ?
Thanks a lot,
Derek
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should connect to the database source first and on success pass the CDatabase object to the constructor of CRecordSet to use that established connection.