ADO Error 對(duì)象

2018-02-08 11:44 更新

ADO Error 對(duì)象

ADO Error 對(duì)象為你提供數(shù)據(jù)訪問錯(cuò)誤的信息。


Error 對(duì)象

ADO Error 對(duì)象包含與單個(gè)操作(涉及提供者)有關(guān)的數(shù)據(jù)訪問錯(cuò)誤的詳細(xì)信息。

ADO 會(huì)因每次錯(cuò)誤產(chǎn)生一個(gè) Error 對(duì)象。每個(gè) Error 對(duì)象包含具體錯(cuò)誤的詳細(xì)信息,且 Error 對(duì)象被存儲(chǔ)在 Errors 集合中。要訪問這些錯(cuò)誤,就必須引用某個(gè)具體的連接。

循環(huán)遍歷 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 返回一個(gè)錯(cuò)誤描述。
HelpContext 返回 Microsoft Windows help system 中某個(gè)主題的內(nèi)容 ID。
HelpFile 返回 Microsoft Windows help system 中幫助文件的完整路徑。
NativeError 返回來自 provider 或數(shù)據(jù)源的錯(cuò)誤代碼。
Number 返回可標(biāo)識(shí)錯(cuò)誤的一個(gè)唯一的數(shù)字。
Source 返回產(chǎn)生錯(cuò)誤的對(duì)象或應(yīng)用程序的名稱。
SQLState 返回一個(gè) 5 字符的 SQL 錯(cuò)誤碼。
在下一節(jié)內(nèi)容中,你將了解有關(guān) ADO Field 對(duì)象的內(nèi)容。
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)