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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert for each in request form 1

Status
Not open for further replies.

lorca

Technical User
Dec 20, 2005
64
GB
Hi i have this bit of code

Code:
Dim item
For Each item in Request.Form
Response.write "<input type=text name=FieldName value=" & item & ">" & vblf
Response.write "<input type=text name=FieldValue value=" & Request.Form(item) & ">" & vblf
Next

which outputs all field names and their values onto a screen. I have a sql table setup with 2 columns fieldname varchar(50) and fieldvalue varchar(2000).

how can i insert these values into the sql table from asp please (i have an include file which needs to do the inserts)?

sort of like

Code:
"INSERT INTO CCCu_CustomValues (FieldName, FieldValue) values(?,?)", Array(advarchar, 50, 
request("FieldName"),advarchar, 2000,request("FieldValue"))"

thanks
tony
 
Assuming an ADO connection object named adoCN
AND a table named CCCu_CustomValues
WITH ONLY 2 Fields: FieldName and FieldValue
AND both fields are text fields
[tt]
For Each item in Request.Form
strSQL = "INSERT INTO CCCu_CustomValues " _
& "VALUES ('" & item & "','" & Request.Form(item) & "')"

adoCN.Execute strSQL
Next
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top