Error trapping in ASP Classic is poor, you just count with on error resume next, on error goto 0 and the err object.
<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "data source name", "userid", "password"
'turn on error trapping
on error resume next
'execute the code you want to check for error
cn.Execute "some insert/update/delete SQL sentence"
'check for errors
if err.number <> 0 then
response.write "There was an error code " & err.number & " and description " & err.description
end if
'turn error trapping off
on error goto 0
%>
Source and more information at Microsoft: Error handling sample from ASP101
|