Muokkaa

Jaa


CDBErrorInfo Class

Provides support for OLE DB error processing using the OLE DB IErrorRecords interface.

Syntax

class CDBErrorInfo

Requirements

Header: atldbcli.h

Members

Methods

Name Description
GetAllErrorInfo Returns all error information contained in an error record.
GetBasicErrorInfo Calls IErrorRecords::GetBasicErrorInfo to return basic information about the specified error.
GetCustomErrorObject Calls IErrorRecords::GetCustomErrorObject to return a pointer to an interface on a custom error object.
GetErrorInfo Calls IErrorRecords::GetErrorInfo to return an IErrorInfo interface pointer to the specified record.
GetErrorParameters Calls IErrorRecords::GetErrorParameters to return the error parameters.
GetErrorRecords Gets error records for the specified object.

Remarks

This interface returns one or more error records to the user. Call CDBErrorInfo::GetErrorRecords first, to get a count of error records. Then call one of the access functions, such as CDBErrorInfo::GetAllErrorInfo, to retrieve error information for each record.

CDBErrorInfo::GetAllErrorInfo

Returns all the types of error information contained in an error record.

Syntax

HRESULT GetAllErrorInfo(ULONG ulRecordNum,
   LCID lcid,  BSTR* pbstrDescription,
   BSTR* pbstrSource = NULL,
   GUID* pguid = NULL,
   DWORD* pdwHelpContext = NULL,
   BSTR* pbstrHelpFile = NULL) const throw();

Parameters

ulRecordNum
[in] The zero-based number of the record for which to return error information.

lcid
[in] The locale ID for the error information to be returned.

pbstrDescription
[out] A pointer to a text description of the error or NULL if the locale is not supported. See Remarks.

pbstrSource
[out] A pointer to a string containing the name of the component that generated the error.

pguid
[out] A pointer to the GUID of the interface that defined the error.

pdwHelpContext
[out] A pointer to the help context ID for the error.

pbstrHelpFile
[out] A pointer to a string containing the path to the help file that describes the error.

Return Value

S_OK if successful. See IErrorRecords::GetErrorInfo in the OLE DB Programmer's Reference for other return values.

Remarks

The output value of pbstrDescription is obtained internally by calling IErrorInfo::GetDescription, which sets the value to NULL if the locale is not supported, or if both of the following conditions are true:

  1. the value of lcid is NOT U.S. English and

  2. the value of lcid is NOT equal to the value returned by GetUserDefaultLCID.

CDBErrorInfo::GetBasicErrorInfo

Calls IErrorRecords::GetBasicErrorInfo to return basic information about the error, such as the return code and provider-specific error number.

Syntax

HRESULT GetBasicErrorInfo(ULONG ulRecordNum,
   ERRORINFO* pErrorInfo) const throw();

Parameters

See IErrorRecords::GetBasicErrorInfo in the OLE DB Programmer's Reference.

Return Value

A standard HRESULT.

CDBErrorInfo::GetCustomErrorObject

Calls IErrorRecords::GetCustomErrorObject to return a pointer to an interface on a custom error object.

Syntax

HRESULT GetCustomErrorObject(ULONG ulRecordNum,
   REFIID riid,IUnknown** ppObject) const throw();

Parameters

See IErrorRecords::GetCustomErrorObject in the OLE DB Programmer's Reference.

Return Value

A standard HRESULT.

CDBErrorInfo::GetErrorInfo

Calls IErrorRecords::GetErrorInfo to return an IErrorInfo interface pointer to the specified record.

Syntax

HRESULT GetErrorInfo(ULONG ulRecordNum,
   LCID lcid,IErrorInfo** ppErrorInfo) const throw();

Parameters

See IErrorRecords::GetErrorInfo in the OLE DB Programmer's Reference.

Return Value

A standard HRESULT.

CDBErrorInfo::GetErrorParameters

Calls IErrorRecords::GetErrorParameters to return the error parameters.

Syntax

HRESULT GetErrorParameters(ULONG ulRecordNum,
   DISPPARAMS* pdispparams) const throw();

Parameters

See IErrorRecords::GetErrorParameters in the OLE DB Programmer's Reference.

Return Value

A standard HRESULT.

CDBErrorInfo::GetErrorRecords

Gets error records for the specified object.

Syntax

HRESULT GetErrorRecords(IUnknown* pUnk,
   const IID& iid,
   ULONG* pcRecords) throw();

HRESULT GetErrorRecords(ULONG* pcRecords) throw();

Parameters

pUnk
[in] Interface to the object for which to get error records.

iid
[in] The IID of the interface associated with the error.

pcRecords
[out] A pointer to the (one-based) count of error records.

Return Value

A standard HRESULT.

Remarks

Use the first form of the function if you want to check which interface to get the error information from. Otherwise, use the second form.

See also

DBViewer
OLE DB Consumer Templates
OLE DB Consumer Templates Reference