Forums
This topic is locked
Insert multiple rows
Posted 15 Jan 2004 04:46:27
1
has voted
15 Jan 2004 04:46:27 Tracy Hughes posted:
I have a form which passes 1 variable from one form, and several from the next as it's a set of checkboxes, I want to use the posted info in an update command on the next page but I get error that columns and query values are'nt the same, can I update several rows with the amount of checkboxes, is there a way to create a loop to keep running the update for every row needed, Ive treid a few combos with no success.Thanks in advance!
Replies
Replied 16 Jan 2004 03:08:12
16 Jan 2004 03:08:12 Tracy Hughes replied:
Here's My code, I'm not getting any errors but it's not inserting!
<%
DIM mySQL, conntemp, myDSN
myDSN= "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Inetpub\wwwroot\kevin\fac.mdb;Uid=Admin;Pwd=pass;"
set conntemp=server.createobject("adodb.connection" )
conntemp.open myDSN
FOR i = 1 to 129
IF Request("ChildID" & i) > "" THEN
mySQL = " INSERT INTO ServicesContractor (facContractorID, facServicesChildID) VALUES"
mySQL = mySQL & " (" & Request("facContractorID" ) & ", " & Request("ChildID" & i) & ""
Response.write(mySQL)
conntemp.execute(mySQL)
END IF
NEXT
conntemp.close
set conntemp=nothing
%>
<%
Response.Redirect("AdminMenu.asp"
%>
The Request("ChildID" is the checkboxes that have multiple results
<%
DIM mySQL, conntemp, myDSN
myDSN= "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Inetpub\wwwroot\kevin\fac.mdb;Uid=Admin;Pwd=pass;"
set conntemp=server.createobject("adodb.connection" )
conntemp.open myDSN
FOR i = 1 to 129
IF Request("ChildID" & i) > "" THEN
mySQL = " INSERT INTO ServicesContractor (facContractorID, facServicesChildID) VALUES"
mySQL = mySQL & " (" & Request("facContractorID" ) & ", " & Request("ChildID" & i) & ""
Response.write(mySQL)
conntemp.execute(mySQL)
END IF
NEXT
conntemp.close
set conntemp=nothing
%>
<%
Response.Redirect("AdminMenu.asp"
%>
The Request("ChildID" is the checkboxes that have multiple results