我一直在尝试为我们的经典asp网站创建一个错误处理路径。我一直在寻找3小时的信息,甚至在堆栈溢出时也没有找到太多信息。所以,如果你能指出一个重复的伟大...我找不到任何东西,虽然它必须存在。
我的计划如下......
我创建了以下页面以开始测试。但它没有用。
Dim cmd
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = con
cmd.CommandType = adCmdStoredProc
on error resume next
cmd.CommandText = "spReturnDBException"
cmd.CommandTimeout = 30 ' 2 minutes
cmd.Execute
dim objErr
set objErr = Server.GetLastError()
if objError.ASPCode <> 0 then
response.write("ASPCode=" & objErr.ASPCode)
response.write("")
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("")
response.write("Category=" & objErr.Category)
response.write("")
response.write("Column=" & objErr.Column)
response.write("")
response.write("Description=" & objErr.Description)
response.write("")
response.write("File=" & objErr.File)
response.write("")
response.write("Line=" & objErr.Line)
response.write("")
response.write("Number=" & objErr.Number)
response.write("")
response.write("Source=" & objErr.Source)
else
response.write("There's nothing wrong.")
end if
Dim objErr2
for each objErr2 in objConn.Errors
response.write("<p>")
response.write("Description: ")
response.write(objErr2.Description & "<br />")
response.write("Help context: ")
response.write(objErr2.HelpContext & "<br />")
response.write("Help file: ")
response.write(objErr2.HelpFile & "<br />")
response.write("Native error: ")
response.write(objErr2.NativeError & "<br />")
response.write("Error number: ")
response.write(objErr2.Number & "<br />")
response.write("Error source: ")
response.write(objErr2.Source & "<br />")
response.write("SQL state: ")
response.write(objErr2.SQLState & "<br />")
response.write("</p>")
next
Free(cmd)
Free(con)
在存储过程中我只是RAISERROR(N'Lets因为我想要抛出错误!',17,0);
我每次得到的输出如下......
ASPCode = ASPDescription =类别=柱= -1Description =文件=行= 0Number = 0Source = 描述:帮助上下文:帮助文件:本机错误:错误号:错误源:SQL状态:
为什么我没有收到有关conn.Errors循环的任何错误信息?
我在循环中使用了一个不同的连接对象来循环连接。错误...复制粘贴错误。
然而,在旁注...我发现很难找到有关如何做到目前为止的信息。
答案 0 :(得分:0)