D
Drew
I need to iterate through a submitted form, inserting data on each pass. In
the past, I have always used form elements that were named with numbers at
the end, like this,
name1 relationship1
name2 relationship2
name3 relationship3
With the above formatting, I could write a For... Next loop to insert all
the data into my database,
For i = 1 to 3
If Request.Form("name" & i) <> "" Then
sql = INSERT INTO Table (Name, Relationship)
sql = sql & " VALUES"
sql = sql & "('" Request.Form("name" & i) "',"
sql = sql & "('" Request.Form("relationship" & i) "')"
'Execute SQL
End If
Next
Now I am working on a new loop, but do not want to go back and change the
way the submitting page works. I saw on while researching that I can use a
For each item in Request.Form, but tried this and it throws off my SQL
statement. It adds all of the request.form values to the sql statement,
which then fails.
How can I make this loop?
Thanks,
Drew
the past, I have always used form elements that were named with numbers at
the end, like this,
name1 relationship1
name2 relationship2
name3 relationship3
With the above formatting, I could write a For... Next loop to insert all
the data into my database,
For i = 1 to 3
If Request.Form("name" & i) <> "" Then
sql = INSERT INTO Table (Name, Relationship)
sql = sql & " VALUES"
sql = sql & "('" Request.Form("name" & i) "',"
sql = sql & "('" Request.Form("relationship" & i) "')"
'Execute SQL
End If
Next
Now I am working on a new loop, but do not want to go back and change the
way the submitting page works. I saw on while researching that I can use a
For each item in Request.Form, but tried this and it throws off my SQL
statement. It adds all of the request.form values to the sql statement,
which then fails.
How can I make this loop?
Thanks,
Drew