Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 SQL querry inside a loop using ASP?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-17 : 21:50:37
Tyler writes "I have a web based application that (if I get this one issue solved) enters data into an access database. In the first part of the program the user is prompted to enter a numeric value. That number of text entry boxes is then generated for data to be entered. For instance, if I were to enter a value of 4 then 4 textboxes would be created. The naming system for the textboxes is as follows: each textbox is named "text" and the number of the order in which it was created. In otherwords, the first textbox is "text1", the 4th is "text4."
Now here's my problem...In my asp page I have a FOR loop (for i = 1 to #_of_textboxes). I'd like the loop to add each textbox to the database so I was trying this within the loop: "INSERT INTO mytable(the_text) VALUE('" & request.form("text" & i) & "' )"
The problem, as best I can tell, is the ampersand after "text." As you can see, the ampersand is necessary to allow for the addition of the value of "i" which is what distinguishes which textbox is being added in the loop. In theory, if the loop was looping for the second time then the value of "i" would be 2 so I would be inserting "request.form("text2"). What can I do to make the ampersand work with the sql statement?

Thanks a million for your help!
~Tyler"

   

- Advertisement -