
以下是引用片段: 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 |
以下是引用片段: <% '設(shè)置buffer為True Response.Buffer = True '開始錯(cuò)誤處理 On Error Resume Next %> <% '錯(cuò)誤處理 If Err.Number <> 0 Then '清除頁面 Response.Clear '顯示錯(cuò)誤信息給用戶 %> <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> 錯(cuò)誤 Number: <%= Err.Number %><BR> 錯(cuò)誤信息: <%= Err.Description %><BR> 出錯(cuò)文件: <%= Err.Source %><BR> 出錯(cuò)行: <%= Err.Line %><BR> </FONT> </BODY> </HTML> <%End If%> |
以下是引用片段: If Err.Number = 0 And objConnection.Errors.Count = 0 Then '這里才能執(zhí)行語句,因?yàn)闆]有錯(cuò)誤 Set rstResults = dbData.Execute(txtSql) End If 更多高級的處理辦法 當(dāng)一個(gè)錯(cuò)誤發(fā)生時(shí),你們也可以顯示更多的錯(cuò)誤信息。下面是同時(shí)處理數(shù)據(jù)庫和頁面錯(cuò)誤的例子,有了它我們一下就能發(fā)現(xiàn)我們程序中的所有錯(cuò)誤。 <% If Err.Number <> 0 Then Response.Clear Select Case Err.Number Case 8 '指定錯(cuò)誤的Number '在這里處理自定義錯(cuò)誤 Case Else '一般錯(cuò)誤 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 |
呢 稱: | |
表 情: | |
內(nèi) 容: |
評論內(nèi)容:不能超過 1000 字,需審核,請自覺遵守互聯(lián)網(wǎng)相關(guān)政策法規(guī)。 |
驗(yàn)證碼: | |
您發(fā)布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會、集體和公民的合法權(quán)益;
二、不得發(fā)布國家法律、法規(guī)明令禁止的內(nèi)容;互相尊重,對自己在本站的言論和行為負(fù)責(zé);
三、本站對您所發(fā)布內(nèi)容擁有處置權(quán)。