AfxThrowDBException

void AfxThrowDBException( RETCODE nRetCode, CDatabase* pdb, HSTMT hstmt );

Parameters

nRetCode

A value of type RETCODE, defining the type of error that caused the exception to be thrown.

pdb

A pointer to the CDatabase object that represents the data source connection with which the exception is associated.

hstmt

An ODBC HSTMT handle that specifies the statement handle with which the exception is associated.

Remarks

Call this function to throw an exception of type CDBException from your own code. 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 ODBC SDK Programmer’s Reference. For information about MFC extensions to these codes, see class CDBException.

See Also   CDBException::m_nRetCode