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

Insert Multiple Lines For i Loop 1

Status
Not open for further replies.

girky

Programmer
Oct 24, 2002
72
US
Hello

I'm trying to insert multiple lines into a table with variable called desc1, desc2, desc3...desc10. And I can't get the proper syntax. I've tried:

('" & desci "')
('" & desc(i) "')
('" "desc" & i & "')
('" & desc( & i & ) "') and a few others I think

Here's the code:
For i = 1 to 10
sql_add = sql_add & "INSERT INTO REQUEST_SUB(DESCRIPTION)"
sql_add = sql_add & "VALUES "
sql_add = sql_add & "('" & desc( & i & ) "');"
next


Any help is greatly appreciated. Thank you
 
Sounds like you need the EVAL() function....

For i = 1 to 10
sql_add = sql_add & "INSERT INTO REQUEST_SUB(DESCRIPTION)"
sql_add = sql_add & "VALUES "
sql_add = sql_add & "('" & EVAL("desc" & i) & "');"
next -----------------------------------------------------------------
DIM bulb
SET bulb = NEW brain

mikewolf@tst-us.com
 
Works great. I learn something new everyday. Thanks so much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top