Convert a string into a variable
Is there a way to convert a string and return the variable value
Here is some code to show what I'm doing.
dim conn, rs,strSQL,i, tempstr,strSQL1,strSQL2 'etc....
strconn = "connection string"
strSQL = "insert into Guestbook (Name,Comment) "
strSQL1 = "Values('Name 1','Comment 1')"
strSQL2 = "Values('Name 2','Comment 2')"
'etc.
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
conn.Open strConn
for i=1 to 36
tempstr = strSQL & Cstr("strSQL" & i)
'at this point I would want tempstr to be
"insert into Guestbook (Name,Comment) Values('Name 1','Comment 1')"
'but I'm getting "insert into Guestbook (Name,Comment) strSQL1
rs.Open tempstr,conn
rs.Close
next
conn.Close
set rs = nothing
set conn = nothing
|