CDBException

A CDBException object  represents an exception condition arising from the database classes. The class includes two public data members you can use to determine the cause of the exception or to display a text message describing the exception. CDBException objects are constructed and thrown by member functions of the database classes.

Note   This class is one of MFC’s Open Database Connectivity (ODBC) classes. If you are instead using the newer Data Access Objects (DAO) classes, use CDaoException instead. All DAO class names have “CDao” as a prefix. For more information, see the articles DatabaseTopics (General) and DAO and MFC in Visual C++ Programmer's Guide.

Exceptions are cases of abnormal execution involving conditions outside the program’s control, such as data source or network I/O errors. Errors that you might expect to see in the normal course of executing your program are usually not considered exceptions.

You can access these objects within the scope of a CATCH expression. You can also throw CDBException objects from your own code with the AfxThrowDBException global function.

For more information about exception handling in general, or about CDBException objects, see the articles Exceptions and Exceptions: Database Exceptions in Visual C++ Programmer's Guide.

#include <afxdb.h>

Class MembersBase ClassHierarchy Chart

See Also   CDatabase, CRecordset, CFieldExchange, AfxThrowDBException, CRecordset::Update, CRecordset::Delete, CException