【问题标题】:Vb6 Adodb error codes with equivalent nativeerror具有等效 nativeerror 的 Vb6 Adodb 错误代码
【发布时间】:2015-07-20 17:09:24
【问题描述】:

我需要知道 ADODB SQL Server 连接返回的 Visual Basic 6 错误代码列表。我还想知道每个 SQL ADODB 错误代码的 Err.Nativeerror。

关于我们在哪里可以获得这些错误代码或任何 VB6 代码的任何信息,其中列出了异常和错误代码以及错误详细信息的描述以及错误的含义。

【问题讨论】:

  • ADODB 错误为here(不难发现),本机错误取决于使用的数据访问提供程序。
  • 我需要用于 SQLserver 异常的 vb6 ADODB 错误代码
  • 不要为 VB6 问题标记每种 VB 语言。添加了[ado]。删除了[vb.net][vba][vb.net]

标签: com vb6 ado


【解决方案1】:

带有简要说明的 ADODB 错误代码表位于 ADO Programmer's Reference > ADO API Reference > ADO Enumerated Constants

有个说明:

OLE DB 错误可能会传递到您的 ADO 应用程序。通常,这些 可以通过 Windows 设施代码 4 来识别。例如, 0x8004。

还要确定HRESULT 错误代码是否为ADODB 错误,此附加说明表明:

十六进制 - 完整错误号的十六进制表示。 Windows 设施代码在第四位。设施代码 ADO 错误编号为 A。例如:0x800A0E7B。

另请参阅 Microsoft 的 [MS-ERREF]: Windows Error Codes,其中包含指向 Microsoft 文档的 pdf 的链接,其中包含相当全面的代码列表及其描述。有一个 RSS 提要订阅更新通知。

查看来自 Symantech 的非常全面的 Error Codes list for Microsoft technologies 列表。

请参阅此Wikipedia topic HRESULT,描述 Microsoft 用于 HRESULT 错误代码的错误代码格式。从主题中,关于如何使用位的格式是:

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 是我没有正确设置 SAFEARRAY。见usage differences between _variant_t, COleVariant, CComVariant, and VARIANT and using SAFEARRAY variations

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-10
    • 1970-01-01
    • 2012-08-15
    • 1970-01-01
    • 2011-05-01
    • 2015-03-04
    • 1970-01-01
    相关资源
    最近更新 更多