ADO Error 對象
Error 對象
ADO Error 對象包含與單個操作(涉及提供者)有關的數據訪問錯誤的詳細信息。
ADO 會因每次錯誤產生一個 Error 對象。每個 Error 對象包含具體錯誤的詳細信息,且 Error 對象被存儲在 Errors 集合中。要訪問這些錯誤,就必須引用某個具體的連接。
循環遍歷 Errors 集合:
<% for each objErr in objConn.Errors response.write("<p>") response.write("Description: ") response.write(objErr.Description & "<br />") response.write("Help context: ") response.write(objErr.HelpContext & "<br />") response.write("Help file: ") response.write(objErr.HelpFile & "<br />") response.write("Native error: ") response.write(objErr.NativeError & "<br />") response.write("Error number: ") response.write(objErr.Number & "<br />") response.write("Error source: ") response.write(objErr.Source & "<br />") response.write("SQL state: ") response.write(objErr.SQLState & "<br />") response.write("</p>") next %>
語法
objErr.property
屬性
屬性 | 描述 |
---|---|
Description | 返回一個錯誤描述。 |
HelpContext | 返回 Microsoft Windows help system 中某個主題的內容 ID。 |
HelpFile | 返回 Microsoft Windows help system 中幫助文件的完整路徑。 |
NativeError | 返回來自 provider 或數據源的錯誤代碼。 |
Number | 返回可標識錯誤的一個唯一的數字。 |
Source | 返回產生錯誤的對象或應用程序的名稱。 |
SQLState | 返回一個 5 字符的 SQL 錯誤碼。 |