[thelist] ASP Err Object in IIS 5

Tab Alleman Tab.Alleman at realmetros.com
Tue Apr 30 17:08:01 CDT 2002


I am trying (still) to get to "hello world" with the ASPError Object in
IIS 5 (Not using .NET...yet.)

Here's my test.asp script:

-------------

<%
Option Explicit
'On Error Resume Next
Dim oErr
Dim oConn, rs, sql
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "xCentral"

Set oErr = Server.GetLastError()
Response.Write("<h3>Error Properties: </h3>")
Response.Write("AspCode: " & oErr.ASPCode & "<br>" & _
				"Number: " & oErr.Number & "<br>" & _
				"Source: " & oErr.Source & "<br>" & _
				"Category: " & oErr.Category & "<br>" &
_
				"File: " & oErr.File & "<br>" & _
				"Line: " & oErr.Line & "<br>" & _
				"Column: " & oErr.Column & "<br>" & _
				"Description: " & oErr.Description &
"<br>" & _
				"ASPDescription: " & oErr.ASPDescription
& "<br>" & _
				"<br>")

Set oErr = Nothing

sql = "SELECT * FROM SupplierRules"
Response.Write("<h3>Debug: " & sql & "</h3>")
Set rs = oConn.Execute(sql)


Response.Write("<h3>Debug: " & rs.fields(0).value & "</h3>")


rs.close()
Set rs = Nothing
oConn.Close()
Set oConn = Nothing

%>

Done.

-------------

With the "On Error.." line commented out (as shown), the page returns
the following error, which is expected because I don't have a DSN named
"xCentral":

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/test/Errors/test1.asp, line 7

----------
But with error handling enabled, I get the following output:

Error Properties:
AspCode:
Number: 0
Source:
Category:
File:
Line: 0
Column: -1
Description:
ASPDescription:


Debug: SELECT * FROM SupplierRules
Done.

---------------
In other words, the ASP error object is apparently NOT getting
populated.
Any idea why?  Is it because it's an OLE error which makes it not
technically an ASP error?  Because that would be really lame... do I
need a separate error handler for non-ASP ASP errors?  Grrrr...

TIA,
Tab




More information about the thelist mailing list