Wrox Programmer Forums
|
Classic ASP Basics For 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
 
Old January 19th, 2005, 07:35 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple Insert

Hello,

  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.


---------

 
Old January 19th, 2005, 07:48 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry,

  I forgot to mention
on error resume next in the first post. I did with that also. Still same problem.

  Eventhough, it hasn't execute strQry2/strQry3(if any error),
 displaying message "Operation succeded"


---------------






Similar Threads
Thread Thread Starter Forum Replies Last Post
insert value into multiple table AzlanAziz SQL Language 5 January 12th, 2007 06:01 AM
How t o insert multiple values qazi_nomi Access ASP 2 May 3rd, 2005 12:45 AM
Multiple Insert Loop HeadMelt Classic ASP Professional 1 November 7th, 2004 09:26 PM
Insert multiple records mateenmohd Access 13 November 2nd, 2004 09:15 AM
Multiple value insert mateenmohd SQL Server 2000 3 October 7th, 2003 12:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.