|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Call this function to throw an exception of type CDBException from your own code.
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.