Reputation: 112
I need to know the list of Visual Basic 6 error codes returned by ADODB SQL Server connection. I also want to know the Err.Nativeerror for each SQL ADODB error code.
Any information about where we can get these errors codes or any VB6 codes which list the exceptions and error codes with descriptions of the error details and what the errors mean.
Upvotes: 1
Views: 2137
Reputation: 17573
A table of the ADODB error codes with brief descriptions are located at ADO Programmer's Reference > ADO API Reference > ADO Enumerated Constants.
There is a note:
OLE DB errors may be passed to your ADO application. Typically, these can be identified by a Windows facility code of 4. For example, 0x8004.
Also to determine if an HRESULT
error code is an ADODB error, this additional note indicates:
Hexadecimal—The hexadecimal representation of the full error number. The Windows facility code is in the fourth digit. The facility code for ADO error numbers is A. For example: 0x800A0E7B.
See also [MS-ERREF]: Windows Error Codes from Microsoft which has a link to a pdf of a document from Microsoft with a fairly comprehensive list of codes and their descriptions. There is an RSS feed to subscribe for notifications of updates.
See as well as very comprehensive list of Error Codes list for Microsoft technologies from Symantech.
See this Wikipedia topic HRESULT describing the error code format used by Microsoft for HRESULT error codes. From the topic the format as to how bits are used is:
S - Severity - indicates success/fail
0 - Success
1 - Failure
R - Reserved portion of the facility code, corresponds to NT's second severity bit.
1 - Severe Failure
C - Customer. This bit specifies if the value is customer-defined or Microsoft-defined.
0 - Microsoft-defined
1 - Customer-defined
N - Reserved portion of the facility code. Used to indicate a mapped NT status value.
X - Reserved portion of the facility code. Reserved for internal use. Used to indicate HRESULT values that are not status values, but are instead message ids for display strings.
Facility - indicates the system service that is responsible for the error. Example facility codes are shown below (for the full list see [1]).
1 - RPC
2 - Dispatch (COM dispatch)
3 - Storage (OLE storage)
4 - ITF (COM/OLE Interface management)
7 - Win32 (raw Win32 error codes)
8 - Windows
9 - SSPI
10 - Control
11 - CERT (Client or server certificate)
...
Code - is the facility's status code
The ITF facility code has subsequently been recycled as the range in which COM components can define their own component-specific error code.
A few of the more common codes are:
adErrItemNotFound - -2146825023 or 0x800A0CC1 - Item cannot be found in the collection that corresponds to the requested name or ordinal.
adErrNoCurrentRecord - -2146825267 or 0x800A0BCD - Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
adErrObjectNotSet - -2146824868 or 0x800A0D5C - Object is no longer valid.
One programmer error that I have done myself which resulted in an HRESULT of 0x800A0CC1 when doing an Update()
is that the I did not have my SAFEARRAY setup properly. See usage differences between _variant_t, COleVariant, CComVariant, and VARIANT and using SAFEARRAY variations.
Upvotes: 2