简单问题 快来看看!!

virtualboy 2001-06-18 02:29:00
在中ASP如何进行错误处理???
on error resume next???
它的程序流程是什么?
请举例说明!!!
...全文
71 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
virtualboy 2001-06-20
  • 打赏
  • 举报
回复
tonnycncn 2001-06-18
  • 打赏
  • 举报
回复
看看我的例子!
<%
Dim gObjDC ' db connection
Dim myDSN ' DSN name
Dim myTable ' Table name

Sub OpenConnection(pDSNName)
On Error Resume Next
Set gObjDC = Server.CreateObject("ADODB.Connection")
gObjDC.ConnectionTimeOut = 15
gObjDC.CommandTimeOut = 30
gObjDC.Open pDSNName, "", ""
If Err <> 0 Then
Response.Clear
Response.Write "<H1> JTMR aspMyAdmin Error </H1>"
Response.Write "<P>The DSN <I>" & pDSNName & "</I> is invalid...</P>"
Response.Write "Return to <A HREF='../welcome.html'>JTMR aspMyAdmin :: Home Page</A>"
Response.End
End If
End Sub
Sub CloseConnection
gObjDC.Close
Set gObjDC = nothing
End Sub
Function GetType(pConstant)
Select Case pConstant
Case adBinary
GetType = "BINARY"
Case adBoolean
GetType = "BOOLEAN"
Case adUnsignedTinyInt
GetType = "BYTE"
Case adInteger
GetType = "LONG"
Case adCurrency
GetType = "CURRENCY"
Case adDBTimeStamp
GetType = "DATETIME"
Case adSingle
GetType = "SINGLE"
Case adDouble
GetType = "DOUBLE"
Case adSmallInt
GetType = "SHORT"
Case adLongVarChar
GetType = "LONGTEXT"
Case adLongVarBinary
GetType = "LONGBINARY"
Case adVarChar
GetType = "TEXT"
Case Else
GetType = "UNKNOW(" & pConstant & ")"
End Select
End Function
Function JTMRCreateAmericanDate(pDateStr)
myDD = Day(pDateStr)
myMM = Month(pDateStr)
myYYYY = Year(pDateStr)
myHH = Hour(pDateStr)
myMin = Minute(pDateStr)
mySec = Second(pDateStr)
JTMRCreateAmericanDate = myMM & "/" & myDD & "/" & myYYYY & " " & myHH & ":" & myMin & ":" & mySec
End Function
myDSN = Request.Form("DSN_Name")
If myDSN = "" Then
myDSN = Request.QueryString("DSN_Name")
End If
myTable = Request.Form("Table_Name")
If myTable = "" Then
myTable = Request.QueryString("Table_Name")
End If
Call OpenConnection(myDSN)
%>
hope2002 2001-06-18
  • 打赏
  • 举报
回复
<% on error resume next %>
加入上面的那条语句,意思是将一切系统的错误提示屏蔽,这时如果想要处理错误信息的显示只能是利用Error对象!
if err.number >0 then
response.write "发生错误<br>"
response.write "数据代码:"&Err.Number&"<br>"
response.write "代码说明:"&Err.Description
else
response.write "<center>成功,请返回!</center>"
end if
virtualboy 2001-06-18
  • 打赏
  • 举报
回复
我的意思是如何使用on error resume next?如何捕获错误?程序代码运行的顺序是什么?
hareqiqi 2001-06-18
  • 打赏
  • 举报
回复
err.description

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧