2015-07-20 64 views
1

我需要知道ADODB SQL Server連接返回的Visual Basic 6錯誤代碼的列表。我也想知道每個SQL ADODB錯誤代碼的Err.Nativeerror。Vb6具有等效原生錯誤的Adodb錯誤代碼

有關我們可以在哪裏獲得這些錯誤代碼或任何VB6代碼的信息,其中列出了例外和錯誤代碼以及錯誤細節的描述以及錯誤的含義。

+0

ADODB錯誤是[here](https://msdn.microsoft.com/en-us/library/windows/desktop/ms677004%28v=vs.85%29.aspx)(不難發現),本地錯誤取決於使用的數據訪問提供程序。 – GSerg

+0

我需要SQL Server異常的vb6 ADODB錯誤代碼 – Ramselvaraj

+1

不要爲VB6問題標記每個VB語言。增加了'[ado]'。刪除了[vb.net]','[vba]','[vb.net]'。 – Bond

回答

2

有關簡要說明的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錯誤代碼的錯誤代碼格式。從主題格式爲位是如何使用的是: HRESULT error code format

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()時,0x800A0CC1的HRESULT是我沒有正確地設置SAFEARRAY。見usage differences between _variant_t, COleVariant, CComVariant, and VARIANT and using SAFEARRAY variations