简单问题 快来看看!!

virtualboy 2001-06-18 02:29:00
在中ASP如何进行错误处理???
on error resume next???
它的程序流程是什么?
请举例说明!!!
...全文
37 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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
回复
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2001-06-18 02:29
社区公告
暂无公告