How to check if an SQL query executed without error in ASP?
- by Sam
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