Script from variables

P

p byers

Hi
If I put a line of VBScript into a variable, is it possible to
execute/process that line of Script.

I want to do something like:



'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

For Each item In Request.Form
cVBScriptLine = "c" & item & " = Request.Form(""" & item & """)"

''The next Line proves to me that I have got the correct ScriptLine
Response.Write (cVBScriptLine & "<br>")


'' I want to Execute?Process cVBScriptLine

'' Wondered if Eval might do it
'' It does not throw an Error but it does not do it !!
Eval( cVBScriptLine )
Next


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



Where I have loads of data appearing, it will save me mountains of
typing like

cTopRow = Request.Form("TopRow")
etc
etc


In other languages, I seenm to remember that it is called "substitution"
!!!

Thanks in anticipation
Pete (Northolt UK)
 
P

p byers

Bob said:
The command you are looking for is called Execute. Having said that, read
these (especially the secod if you are doing this in server-side script)
before travelling too much further down this path:

http://blogs.gotdotnet.com/ericli/PermaLink.aspx/5f27ae83-ff82-4fea-97db-b6fef3922c3b
http://blogs.msdn.com/ericlippert/archive/2003/11/04/53335.aspx

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Thank you Bob
I will follow the links that you provided

However, for my immediate neds, I looked at the WebPage and saw the lines produced by the
"Response.Write"

Put them into the Clipboard and pasted them int the script.

Bit of lateral thinking !! lol

Pete (Northolt UK)
 
P

p byers

Bob said:
The command you are looking for is called Execute. Having said that, read
these (especially the secod if you are doing this in server-side script)
before travelling too much further down this path:

http://blogs.gotdotnet.com/ericli/PermaLink.aspx/5f27ae83-ff82-4fea-97db-b6fef3922c3b
http://blogs.msdn.com/ericlippert/archive/2003/11/04/53335.aspx

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Bob,

The first link no longer exists.

I understand the warning in the second link

in front of the "for each" loop in my OP, there is another "for each" loop that validates
the input as valid based on the start of the Data Item name

So I feel fairly safe - famous last words !!!

Now I will investigate the "Execute" command

Thanks again

Pete (Northolt UK)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top