How to check if an SQL query executed without error in ASP?

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-04-05T10:16:50Z Indexed on 2010/04/05 10:23 UTC
Read the original article Hit count: 219

Filed under:
|
|

Here's my code:

if Request.Form("authorize") <> "" and request.form("delete") <> "true" then
    post_ids = Request.form("authorize")
    ids = split(post_ids, ",")

    For i = LBound(ids) to UBound(ids)
        sql = "update tbl_comments set authorized = 'true' where comment_id = " & ids(i)
        pageDB.execute(sql)
    Next

    message = "<div id=""succeed""><strong>Updated</strong>: Your comments have been approved.</div>"
end if

Instead of just setting "message" to the success message i'd like to do something along the lines of...

if(pageDB.execute(sql) was succesful) then
    message = "<div id=""succeed""><strong>Updated</strong>: Your comments have been approved.</div>"
else 
    message = "<div id=""error""><strong>Error</strong>: Your comments have not been approved.</div>"
end if

© Stack Overflow or respective owner

Related posts about asp

Related posts about mysql