CDaoErrorInfo Structure

The CDaoErrorInfo structure has the following form:

struct CDaoErrorInfo
{
   long m_lErrorCode;
   CString m_strSource;
   CString m_strDescription;
   CString m_strHelpFile;
   long m_lHelpContext;
};

The CDaoErrorInfo structure contains information about an error object defined for data access objects (DAO). MFC does not encapsulate DAO error objects in a class. Instead, the CDaoException class supplies an interface for accessing the Errors collection contained in the DAO DBEngine object, the object that also contains all workspaces. When an MFC DAO operation throws a CDaoException object that you catch, MFC fills a CDaoErrorInfo structure and stores it in the exception object’s m_pErrorInfo member. (If you choose to call DAO directly, you must call the exception object’s GetErrorInfo member function yourself to fill m_pErrorInfo.)

For more information about handling DAO errors, see the article Exceptions: Database Exceptions in Visual C++ Programmer’s Guide. For related information, see the topic "Error Object" in DAO Help.

Members

m_lErrorCode

A numeric DAO error code. See the topic "Trappable Data Access Errors" in DAO Help.

m_strSource

The name of the object or application that originally generated the error. The Source property specifies a string expression representing the object that originally generated the error; the expression is usually the object’s class name. For details, see the topic "Source Property" in DAO Help.

m_strDescription

A descriptive string associated with an error. For details, see the topic "Description Property" in DAO Help.

m_strHelpFile

A fully qualified path to a Microsoft Windows Help file. For details, see the topic "HelpContext, HelpFile Properties" in DAO Help.

m_lHelpContext

A context ID for a topic in a Microsoft Windows Help file. For details, see the topic "HelpContext, HelpFile Properties" in DAO Help.

Comments

Information retrieved by the CDaoException::GetErrorInfo member function is stored in a CDaoErrorInfo structure. Examine the m_pErrorInfo data member from a CDaoException object that you catch in an exception handler, or call GetErrorInfo from a CDaoException object that you create explicitly in order to check errors that might have occurred during a direct call to the DAO interfaces. CDaoErrorInfo also defines a Dump member function in debug builds. You can use Dump to dump the contents of a CDaoErrorInfo object.

For information on using this and other MFC DAO Info structures, see the article DAO Collections: Obtaining Information About DAO Objects in Visual C++ Programmer's Guide.

See Also   CDaoException