I have a page that is using a dynamic table with the repeatable region that is populated from a query to display items for a customer to return. What I did was created text boxes for the item information and have them dynamically populate from the initial query therefore turning the repeated region into a form that upon submit will write data to a SQL database. the problem i am having is when I apply the insert statement to the region and put it into production i get errors for any submission that has more than one item listed (repeated) in the region. I figured out the reason for this is b/c i beleive i am missing a loop statement with the insert. here is the code i have below. can someone help me get this writing to multiple rows? thanks.

<%
If (CStr(Request("MM_insert")) = "form3") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_returnswizard_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.tbl_dtc_returnswizard (SOPNUMBE, CUSTNMBR, ITEMNMBR, ITEMDESC, QTYORDER, QTYTOINV, LISTPRCE, RMA, MSTRNUMB, REASONRETURN, NOTES, STATUS) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("sopnumbe")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("custnmbr")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("itemnmbr")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, -1, Request.Form("itemdesc")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, -1, Request.Form("qtyorder")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, -1, Request.Form("qtytoinv")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, -1, Request.Form("listprce")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 50, MM_IIF(Request.Form("rma"), "Y", "N")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 50, Request.Form("mstrnumb")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 201, 1, -1, Request.Form("reasonreturn")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 201, 1, -1, Request.Form("notes")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 202, 1, 50, Request.Form("status")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "returns4.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>