开发者

How to check the Resultset status?

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开发者_Go百科 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜