
以下是引用片段: Microsoft OLE DB Provider for ODBC Drivers error 80004005 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified /test.asp, line 60 |
以下是引用片段: <% '設置buffer為T(mén)rue Response.Buffer = True '開(kāi)始錯誤處理 On Error Resume Next %> <% '錯誤處理 If Err.Number <> 0 Then '清除頁(yè)面 Response.Clear '顯示錯誤信息給用戶(hù) %> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY BGCOLOR="#C0C0C0"> <FONT FACE="ARIAL">An error occurred in the execution of this ASP page<BR> Please report the following information to the support desk<P> <B>Page Error Object</B><BR> 錯誤 Number: <%= Err.Number %><BR> 錯誤信息: <%= Err.Description %><BR> 出錯文件: <%= Err.Source %><BR> 出錯行: <%= Err.Line %><BR> </FONT> </BODY> </HTML> <%End If%> |
以下是引用片段: If Err.Number = 0 And objConnection.Errors.Count = 0 Then '這里才能執行語(yǔ)句,因為沒(méi)有錯誤 Set rstResults = dbData.Execute(txtSql) End If 更多高級的處理辦法 當一個(gè)錯誤發(fā)生時(shí),你們也可以顯示更多的錯誤信息。下面是同時(shí)處理數據庫和頁(yè)面錯誤的例子,有了它我們一下就能發(fā)現我們程序中的所有錯誤。 <% If Err.Number <> 0 Then Response.Clear Select Case Err.Number Case 8 '指定錯誤的Number '在這里處理自定義錯誤 Case Else '一般錯誤 If IsObject(objConnection) Then If objConnection.Errors.Count > 0 Then %> <B>Database Connection Object</B> <% For intLoop = 0 To objConnection.Errors.Count - 1 %> Error No: <%= objConnection.Errors(intLoop).Number %><BR> Description: <%= objConnection.Errors(intLoop).Description %><BR> Source: <%= objConnection.Errors(intLoop).Source %><BR> SQLState: <%= objConnection.Errors(intLoop).SQLState %><BR> NativeError: <%= objConnection.Errors(intLoop).NativeError %><P> <% Next End If End If If Err.Number <> 0 Then %> <B>Page Error Object</B><BR> Error Number <%= Err.Number %><BR> Error Description <%= Err.Description %><BR> Source <%= Err.Source %><BR> LineNumber <%= Err.Line %><P> <% End If End Select End If %> |
以下是引用片段: If Err.Number = 0 And objConnection.Errors.Count = 0 Then Response.Clear Response.Redirect URL Here End If |
呢 稱(chēng): | |
表 情: | |
內 容: |
評論內容:不能超過(guò) 1000 字,需審核,請自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)政策法規。 |
驗證碼: | |
您發(fā)布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會(huì )、集體和公民的合法權益;
二、不得發(fā)布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發(fā)布內容擁有處置權。