Classic ASP BasicsFor beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I am trying to enter data.
I have a loop to insert data into 3 tables.
the data entered to the first table only once based on the action.
Ex: if action="dir" then
strqry1="insert into issuemain(formid,trdate) values(...)
conn.beginTrans
conn.execute strqry1
if Err.number <> 0 then checkerror 'procedure
executeIssueDet 'procedure to insert into sub table
conn.commitTrans
else
conn.beginTrans
executeIssueDet
conn.commitTrans
end if
response.write "Operation succeeded"
conn.close
sub executeIssueDet()
for j=0 to ubound(arr1)
indno=arr1(j)
strQry2="insert into issuedetails(...) values(...)
strQry3="update inventory set issuedqty=issuedqty+" & curqty & " where invindex=" & indno
conn.execute strQry2
if Err.number<>0 then checkerror
conn.execute strQry3
if err.number <> 0 then checkerror
next
end sub
sub checkerror()
response.write "ERROR"
Err.clear
conn.RollbackTrans
conn.close
response.end
end sub
If any query is wrong(data type mismatch or any)
its not running checkerror procedure. It must rollback all executions had before. Its not doing. The first insert(strQry1) is having data and rest no data(cos some error in the qry). What could be the problem.