[thelist] ASP Loop Question

James Q. Stansfield jqs at iridani.net
Wed Mar 20 13:59:01 CST 2002


EVAL() is a wonderful tool.

<%

variable_1 = "string1"
variable_2 = "string2"
variable_3 = "string3"
variable_4 = "string4"
variable_5 = "string5"
variable_6 = "string6"
variable_7 = "string7"
variable_8 = "string8"
variable_9 = "string9"
variable_10 = "string10"


for x = 1 to 10
    variable = "variable_" & x
    response.write( eval(variable) & "<br>"  )
next


%>
----- Original Message -----
From: "Feingold Josh S" <Josh.S.Feingold at irs.gov>
To: <thelist at lists.evolt.org>
Sent: Wednesday, March 20, 2002 10:31 AM
Subject: [thelist] ASP Loop Question


> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
> --
> [ Picked text/plain from multipart/alternative ]
> I have 10 variables:
>
> variable_1 = "string1"
> variable_2 = "string2"
> ...
> variable_10 = "string10"
>
> I want to insert the variable data into a database as a separate row.  I
> would also like to automate this process.
>
> I tried:
>
> for x = 1 to 10
>     variable = "variable_" & x
>     rs.Open "INSERT INTO database (column) VALUES (' " & variable & " ')"
> next
>
> The issue is that the string "variable_1" gets inserted in the database
> instead of "string1."
>
> Does anyone know what I am doing wrong?
>
> Thanks,
> Josh
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list