Home All Groups Group Topic Archive Search About
Author
20 Jun 2009 2:43 PM
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)

Author
20 Jun 2009 3:12 PM
Bob Barrows
p byers wrote:
> Hi
> If I put a line of VBScript into a variable, is it possible to
> execute/process that line of Script.
>
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"
Are all your drivers up to date? click for free checkup

Author
20 Jun 2009 4:18 PM
p byers
Bob Barrows wrote:

Show quoteHide quote
> p byers wrote:
> > Hi
> > If I put a line of VBScript into a variable, is it possible to
> > execute/process that line of Script.
> >
> 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)
Author
20 Jun 2009 4:28 PM
p byers
Bob Barrows wrote:

Show quoteHide quote
> p byers wrote:
> > Hi
> > If I put a line of VBScript into a variable, is it possible to
> > execute/process that line of Script.
> >
> 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)
Author
20 Jun 2009 5:39 PM
Bob Barrows
p byers wrote:
Show quoteHide quote
> Bob Barrows wrote:
>
>> p byers wrote:
>>> Hi
>>> If I put a line of VBScript into a variable, is it possible to
>>> execute/process that line of Script.
>>>
>> 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
>>
>
> Bob,
>
> The first link no longer exists.
>
It exists - you just have to google it:
http://blogs.msdn.com/ericlippert/archive/2003/11/01/53329.aspx

But you'll probably ignore ths one, too ... ;-)
--
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"

Bookmark and Share