CDBException Class

Represents an exception condition arising from the database classes.

class CDBException : public CException

Remarks

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.

Hinweis

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 article Overview: Database Programming.

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 Exception Handling (MFC) and Exceptions: Database Exceptions.

Requirements

Header: afxdb.h

See Also

Concepts

CDBException Members

CException Class

Hierarchy Chart

CDatabase Class

CRecordset Class

CFieldExchange Class

AfxThrowDBException

CRecordset::Update

CRecordset::Delete

CException Class