Call this function to throw an exception of type CDBException from your own code.
void AfxThrowDBException( RETCODE nRetCode, CDatabase* pdb, HSTMT hstmt );
- A value of type RETCODE, defining the type of error that caused the exception to be thrown.
- A pointer to the CDatabase object that represents the data source connection with which the exception is associated.
- An ODBC HSTMT handle that specifies the statement handle with which the exception is associated.
The framework calls AfxThrowDBException when it receives an ODBC RETCODE from a call to an ODBC API function and interprets the RETCODE as an exceptional condition rather than an expectable error. For example, a data access operation might fail because of a disk read error.
For information about the RETCODE values defined by ODBC, see Chapter 8, "Retrieving Status and Error Information," in the Platform SDK. For information about MFC extensions to these codes, see class CDBException.