Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Multipe Rows of Data To Database Problem

Status
Not open for further replies.

FontanaS

Programmer
May 1, 2001
357
US
Hi! I have the following table on a form that displays multiple rows -

<%Cmd = "SELECT * FROM Tbl_Orders WHERE OrderCcUser = '"&Session("UserSessionUserId")&"' AND OrderMarkedAsSubmit = 'No'"
SET RsReq = CreditCardDb.execute(Cmd)%>
<td align="left"><font face="Tahoma" size="2"><b><u>Orders Waiting For Submittal</u></b></font></td><br>
<table border="1">
<tr>
<td>&nbsp;<%=" "%></td>
<td align="center"><font face="Tahoma" size="2"><u>Total Amount</u></font></td>
<td align="center"><font face="Tahoma" size="2"><u>Action</u></font></td>
</tr>
<%DO WHILE NOT RsReq.Eof%>
<tr>
<td align="center"><input type="hidden" name="OrderId<%=lvCountingSubmit%>" value="<%=RsReq("OrderId")%>">
<td align="center"><font face="Tahoma" size="2"><%=FormatCurrency(RsReq("OrderTotalAmount"),2)%></font></td>
<td align="center"><input type="checkbox" name="ChkBoxSubmit_<%=lvCountingSubmit%>" value="Yes"><font size="2">Submit</font></td>
<%lvCountingSubmit = lvCountingSubmit + 1%>
<%RsReq.MoveNext%>
<%LOOP%>
</tr>
<!--CREATE TEXT FIELD THAT IS HIDDEN TO DISPLAY THE TOTAL NUMBER OF RECORDS IN THE TABLE-->
<input type="hidden" name="lvCountingSubmit" value="<%= (lvCountingSubmit - 1) %>">
</table><br><br>


When the user selects the update button I check to see if they selected the checkbox.

lvCounterSubmit = Request.Form("lvCountingSubmit") + 1
'FOR EACH RECORD IN THE TABLE, DELETE THAT RECORD
FOR x = 1 TO lvCounterSubmit
IF Request.Form("ChkBoxSubmit_" & x) = "Yes" OR Request.Form("ChkBoxSubmit_" & x) = "yes" THEN
CmdRsGetRecordTypes = "SELECT * FROM Tbl_Orders WHERE OrderId = '" & Request.Form("OrderId" & x) & "'"
Response.Write("CmdRsGetRecordTypes - "&CmdRsGetRecordTypes)
'SET RsGetRecordTypes = CreditCardDb.execute (CmdRsGetRecordTypes)
END IF
NEXT

The problem is that the response.write shows -
CmdRsGetRecordTypes - SELECT * FROM Tbl_Orders WHERE OrderId = '5, 1'

It should state -
CmdRsGetRecordTypes - SELECT * FROM Tbl_Orders WHERE OrderId = 5

I can't figure out how the ,1 is getting in there.
Any suggestions is greatly appreciated.
 
you can get a comma separated list in your Request object if your have 2 form elements with the same name or if you have a <select> with multiple
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top