Wrox Programmer Forums
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 16th, 2003, 12:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Variables

I have some ASP that dynamically created some variables and writes them to a VBScript function. In another function (after the page loads), I want to interact with them. I will pass in a text string that is the name of the variable. Is there a way to access the variable somehow using the string with the variable name in it?

Chris
__________________
Chris
Reply With Quote
  #2 (permalink)  
Old August 20th, 2003, 09:14 AM
flp flp is offline
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I think you need to make use of the execute() function. Passing a string to the execute() function actually runs the string as VBScript.

This bit of code takes every form item from the previous page, and replaces all apostrophes within for double apostrophes, and assigns it to a variable of the form items HTML name (useful for building a SQL string):

for each Item in Request.Form
  execute("Dim " & Item)
  execute(Item & " = replace(request.form(""" & item & """), ""'"", ""''"")")
next


Reply With Quote
  #3 (permalink)  
Old August 21st, 2003, 11:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks

Chris
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
quicker way to create variables in perl - dynamic? crmpicco Perl 4 March 6th, 2007 07:53 AM
Dynamic variables neo_jakey Classic ASP Professional 3 October 20th, 2005 09:12 AM
Dynamic If...Then using variables Mitch Access 1 March 11th, 2005 10:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.