开发者

Batch data insert

开发者 https://www.devze.com 2023-02-25 18:54 出处:网络
I 开发者_运维问答need to fetch data from one table (multiple rows) and insert into other table after modifying and adding some new fields.

I 开发者_运维问答need to fetch data from one table (multiple rows) and insert into other table after modifying and adding some new fields.

For example:

Table 1 itemid, price, qnt, date_of_dispatch

Table2 Invoiceid, Invoicedate, customer_id, itemid, price, qnt, total_amt, date_of_dispatch, grandtotal

Please help me to make it in asp with ms access

Batch data insert


You need to add all the input type with the same name, so you can collect an array with all the values.

Sample:

<form ...>
   <input type="text" name="InvoiceDate" ..>

   <table>
   <thead>
         ....
   <thead>
   <tbody>
   <% do while not rsItems.EOF %>
    <tr>
       <input type="hidden" name="ItemID" value="<%= trim( rsItems("itemID") ) %>">
       <td><input type="text" name="Product" value="<%= rsItems("Product") %>"></td>
       <td><input type="text" name="Price" value="<%= rsItems("Price") %>"></td>
       <td><input type="text" name="Qnt" value="<%= rsItems("qnt")%>"></td>
    </tr>
    <% rs.movenext %>
   <% loop %>

Then, when processing the form:

for i = 1 to request.form("ItemID").count
   ThisItemProduct = request.form("Product")(i)
   ThisItemPrice = request.form("Price")(i)
   ...

You can work the details.

0

精彩评论

暂无评论...
验证码 换一张
取 消