Helpful Information
Home
Categories
Contact us
Category: ASP
How to know whether is ok when write data to db
I try to save datas to database,
--1. by recordset, rs.addnew..........rs.update
after "update" how can I redirect to page1.asp when secceed;
redirect to page2.asp when failed
--2. by "insert into"/"transaction",
how can I know it is ok or not? I do not want to show the error message to users directly
Many thanks
on error resume next
'statements here
if err.number<>0 then
response.write("Error: " & err.description);
response.end
else
response.redirect("OK.htm");
end if
Copying (with minor modifications) the code already posted:
On Error Resume Next
'database statements here
If Err.Number<>0 Then
Response.Redirect "page2.asp"
Else
Response.Redirect "page1.asp"
End If
I took out the semicolons (';' this isn't JScript) and the brackets around the response.redirect. You don't need them.
~Quack
I guess I'm just confused again... I know that we are discouraged from using it though... even in VBScript.
?!?
privacy (GDPR)