Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To accomplish this, you will need to keep track of two things:</p> <ul> <li>the number of rows that are going to be inserted</li> <li>the data of each row</li> </ul> <p>Tricks to do this, is simple. While you display your data, you increment a variable with the number of loops.</p> <pre><code>&lt;% iNumberOfRecords = 0 Do Until Recordset1.EOF %&gt; &lt;tr&gt; &lt;td&gt; &lt;input name="dipatchid" type="text" id="..." value="&lt;%=Recordset1("dispatchid")%&gt;" /&gt; &lt;/td&gt; ... &lt;/tr&gt; &lt;% iNumberOfRecords = iNumberOfRecords + 1 Recordset1.MoveNext loop Recordset1.Close %&gt;</code></pre> <p>Before you close your <code>&lt;form&gt;</code> tag, you put that in a hidden field.</p> <pre><code>&lt;input type="hidden" name="iNumberOfRecords" value="&lt;%=iNumberOfRecords%&gt;" /&gt;</code></pre> <hr> <p>Next, on the page where you submit to, you loop <code>iNumberOfRecords</code> times to insert all the rows.</p> <pre><code>&lt;% for i = 1 to CInt(Request.Form("iNumberOfRecords")) idOfRecord = GetFormValue("dipatchid", i) otherField = GetFormValue("otherField", i) SQL = "INSERT INTO tblInvoices(dispatchid, otherfield) VALUES ( " & idOfRecord & ", " & otherfield & " )" Connectionobject.Execute(SQL) next Function GetFormValue(sFormname, iIndex) If Request.Form(sFormname).Count >= iIndex And iIndex > 0 Then GetFormValue = Request.Form(sFormname)(iIndex) Else GetFormValue = "" End If End Function %&gt;</code></pre> <p>The <code>(i)</code> fetches the right <code>Request.Form("...")</code> item for you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload