共用方式為


CDaoException::GetErrorInfo

Returns error information about a particular error object in the Errors collection.

void GetErrorInfo(
   int nIndex 
);

Parameters

  • nIndex
    The index of the error information in the database engine's Errors collection, for lookup by index.

Remarks

Call this member function to obtain the following kinds of information about the exception:

  • Error code

  • Source

  • Description

  • Help file

  • Help context

GetErrorInfo stores the information in the exception object's m_pErrorInfo data member. For a brief description of the information returned, see m_pErrorInfo. If you catch an exception of type CDaoException thrown by MFC, the m_pErrorInfo member will already be filled in. If you choose to call DAO directly, you must call the exception object's GetErrorInfo member function yourself to fill m_pErrorInfo. For a more detailed description, see the CDaoErrorInfo structure.

For information about DAO exceptions, and example code, see the article Exceptions: Database Exceptions.

Requirements

Header: afxdao.h

See Also

Reference

CDaoException Class

Hierarchy Chart

CDaoException::GetErrorCount

Other Resources

CDaoException Members