Error Handling in ASP pages is also somewhat limited - the only statements
available to you are the On Error Resume Next
and On Error
Goto 0.
Also bear in mind that although Err
still returns
the last error, Error
does not return the error text. Use Err.Description
instead. An example of error trapping is shown below:
On Error Resume Next
cConn.Execute ("INSERT INTO MyTable (UserName, Password) VALUES ('fred
bloggs','mypassword')
If Err Then
Response.Write "<p><font color=""#FF0000"">An
error occured. Error " & Err & " : " & Err.Description
& "</font></p>"
End If
This can be particularly useful when you need to trap constraint errors generated by the database.
Comments