开发者

Batch data insert

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜