
以下是引用片段: 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为True Response.Buffer = True '开始错误处理 On Error Resume Next %> <% '错误处理 If Err.Number <> 0 Then '清除页面 Response.Clear '显示错误信息给用户 %> <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 '这里才能执行语句,因为没有错误 Set rstResults = dbData.Execute(txtSql) End If 更多高级的处理办法 当一个错误发生时,你们也可以显示更多的错误信息。下面是同时处理数据库和页面错误的例子,有了它我们一下就能发现我们程序中的所有错误。 <% 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 |
您发布的评论即表示同意遵守以下条款:
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家、社会、集体和公民的合法权益;
二、不得发布国家法律、法规明令禁止的内容;互相尊重,对自己在本站的言论和行为负责;
三、本站对您所发布内容拥有处置权。