Home > General > Isqlerrorinfo

Isqlerrorinfo

All rights reserved.

OLE DB Programmer's Reference

Lookup
ID The error lookup service uses the lookup ID in conjunction with the return code to identify the error description, Help See ASP.NET Ajax CDN Terms of Use – http://www.asp.net/ajaxlibrary/CDN.ashx. ]]> OLE DB Provider for Microsoft Jet ISQLErrorInfo ISQLErrorInfo is Syntax Copy HRESULT GetSQLInfo ( BSTR    *pbstrSQLState, LONG    *plNativeError); Parameters pbstrSQLState [out] A pointer to memory in which to return a pointer to a string that contains the SQLSTATE. CHECK_HR(hr = pIErrorRecords->GetCustomErrorObject( iRecord,// iRecord IID_ISQLErrorInfo,// riid (IUnknown**)&pISQLErrorInfo));// ppISQLErrorInfo // If we obtained the ISQLErrorInfo interface, get the SQL // error string and native error code for this error.

For more information, see "Error Lookup Services," later in this chapter. 1998-2001 Microsoft Corporation. If no custom error object exists, this pointer is null. All rights reserved.

OLE DB Programmer's Reference

Custom Error Objects A custom error object can be associated with each error record. CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource)); // Get the basic error information for this record.

if (pISQLServerErrorInfo != NULL) { pISQLServerErrorInfo->GetErrorInfo(&pSSErrorInfo, &pSSErrorStrings); // ISQLServerErrorInfo::GetErrorInfo succeeds // even when it has nothing to return. This documentation is archived and is not being maintained. OLE DB Providers Overview Jet Provider Implementation Details by Interface Implementation Details by Interface ISQLErrorInfo for Microsoft Jet ISQLErrorInfo for Microsoft Jet ISQLErrorInfo for Microsoft Jet IAccessor for Microsoft Jet ICommandPrepare

Please refer to our Privacy Policy or Contact Us for more details You seem to have CSS turned off. For ISQLErrorInfo::GetSQLInfo, pbstrSQLState may be NULL when the error is not produced by SQL Server. In this way, ownership of the custom error object is effectively transferred from the provider to the error object. For more information, see "Error Lookup Services," later in this chapter. 1998-2001 Microsoft Corporation.

Microsoft Customer Support Microsoft Community Forums United States (English) Sign in Security TechCenter Home Security Updates Tools Learn Library Support We’re sorry. Note that ISQLErrorInfo // is not mandatory, so failure is acceptable here. Personal Open source Business Explore Sign up Sign in Pricing Blog Support Search GitHub This repository Watch 73 Star 233 Fork 135 Microsoft/Windows-classic-samples Code Issues 5 Pull requests 1 Projects The provider that created the custom error object calls Release to release its hold on the custom error object.

When to Call Consumers call the methods on ISQLErrorInfo to retrieve the SQLSTATE and native error code. pIErrorInfoAll->GetSource(&bstrSource); pIErrorInfoAll->GetDescription(&bstrDescription); if (bstrSource != NULL) { wprintf_s(L"Source:\t\t%s\n", bstrSource); SysFreeString(bstrSource); } if (bstrDescription != NULL) { wprintf_s(L"Error message:\t%s\n", bstrDescription); SysFreeString(bstrDescription); } } pIErrorInfoAll->Release(); } else { wprintf_s(L"GetErrorInfo failed."); } pISupportErrorInfo->Release(); return; See Also Information in OLE DB Error Interfaces Skip to content Ignore Learn more Please note that GitHub no longer supports old versions of Firefox. We appreciate your feedback.

This example obtains information from the various error interfaces exposed by the SQL Server Native Client OLE DB provider. Method Description GetSQLInfo Returns the SQLSTATE and native error code associated with an error. This documentation is archived and is not being maintained. The SQLSTATE codes generated by the OLE DB Provider for SQL Server are same as the five-character SQLSTATE codes defined in the ODBC specification.

ERRORINFO errorinfo; // IErrorInfo values. OLE DB Reference OLE DB Interfaces ISQLErrorInfo ISQLErrorInfo ISQLErrorInfo::GetSQLInfo ISQLErrorInfo::GetSQLInfo ISQLErrorInfo::GetSQLInfo ISQLErrorInfo::GetSQLInfo TOC Collapse the table of content Expand the table of content This documentation is archived and is not being These SQLSTATE codes are not related to any of the parts of a SQL Server message. See ASP.NET Ajax CDN Terms of Use – http://www.asp.net/ajaxlibrary/CDN.ashx. ]]> Developer Network Developer Network Developer Sign in MSDN subscriptions

For more information, see ISQLErrorInfo. 1998-2001 Microsoft Corporation. This documentation is archived and is not being maintained. SysFreeString(bstrSQLSTATE); // Get the ISQLServerErrorInfo interface from // ISQLErrorInfo before releasing the reference. GetErrorInfo(0, &pIErrorInfoAll); if (pIErrorInfoAll != NULL) { // Test to see if it's a valid OLE DB IErrorInfo interface // exposing a list of records.

IErrorInfo* pIErrorInfoAll = NULL; IErrorInfo* pIErrorInfoRecord = NULL; IErrorRecords* pIErrorRecords = NULL; ISupportErrorInfo* pISupportErrorInfo = NULL; ISQLErrorInfo* pISQLErrorInfo = NULL; ISQLServerErrorInfo* pISQLServerErrorInfo = NULL; // Number of error records. This topic is a part of: Microsoft OLE DB Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? The content you requested has been removed.

CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription)); // Get the source of this error.

Error parameters are inserted into error messages by a provider-specific error lookup service. ISQLErrorInfo ISQLErrorInfo is used to return the SQLSTATE and native error code. Reload to refresh your session. CHECK_HR(hr = pIErrorRecords->GetErrorInfo(iRecord, lcid, &pIErrorInfo)); // Get the description of this error.

When to Call Consumers call the methods on ISQLErrorInfo to retrieve the SQLSTATE and native error code. The error object releases all custom error objects when it is released. In the example, the error parameters would be used to supply the name of the table () that could not be opened. ULONG nRecs; ULONG nRec; // Basic error information from GetBasicErrorInfo.