我需要知道ADODB SQL Server连接返回的Visual 6错误代码列表。我还想知道每个SQL错误代码的Err.Nativeerror。
有关这些错误代码或任何VB6代码的信息,这些代码列出了异常和错误代码,并描述了错误的细节和错误的含义。
发布于 2016-08-22 02:56:45
一个表的ADODB错误代码与简短的描述是位于ADO Programmer's Reference > ADO API Reference > ADO Enumerated Constants。
有一个注意事项:
OLE DB错误可能会传递给ADO应用程序。通常,它们可以通过Windows工具代码4来标识。例如,0x8004。
此外,要确定HRESULT错误代码是否为ADODB错误,此附加说明指示:
十六进制-完全错误数的十六进制表示形式。Windows设施代码为第四位数字。ADO错误号的工具代码是A。例如: 0x800A0E7B。
还请参阅微软的[MS-ERREF]:Windows错误代码,它有一个指向微软文档的pdf的链接,其中有一个相当全面的代码列表和它们的描述。有一个RSS提要订阅更新通知。
请参阅来自Symantech的非常全面的Microsoft技术错误代码列表列表。
请参阅此维基百科主题HRESULT描述Microsoft用于HRESULT错误代码的错误代码格式。从本主题来看,关于如何使用bits的格式是:

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.一些比较常见的代码是:
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.在执行Update()时,我自己做的一个导致HRESULT为0x800A0CC1的程序员错误是,I没有正确地设置SAFEARRAY。见t,COleVariant,CComVariant和变体,并使用SAFEARRAY变体。
https://stackoverflow.com/questions/31522326
复制相似问题