views:

40

answers:

1

This is for vbscript application.

    Dim objRs
    set objRs = server.CreateObject("ADODB.Recordset")
    set objRs = objConn.Execute(sql)

When the sql statement got syntax error, it will cause the whole ASP page into error.

I want to do logging by performing the following: When the query go into error, log the sql into a text file for reference.

Problem here is what is the objRs data looks like when Execute(sql) go into error? Will it return any error code like -1, 8045 etc?

I want to get status of Execution, in order to decide whether to log the sql into textfile.

A: 

Maybe you can use On Error Resume Next, along with some testing of the Err object. This will provide all the necessary info to allow logging at the level of the application, where you have all the desired context and the necessary programming language's expressiveness to express various business rules about what and when to log...

Furthermore the On Error statement will allow the elegant handling of exceptions, without "messing" the whole ASP page.

mjv