Login | |
|
 |
RE: Dynamically Declaring Variables - 6/26/2006 7:09:42 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
I would suggest looking into using a dictionary object. If I understand your situation, here is a psuedocode demonstration Set oNamesDic = CreateObject("Scripting.Dictionary") oNameDic.Add #1st name from the database#, 1 oNameDic.Add #2nd name from the database#, 8 oNameDic.Add #3rd name from the database#, 13 WScript.Echo #1st name from the database# & " = " & oNameDic(#1st name from the database#)
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Dynamically Declaring Variables - 6/26/2006 8:28:37 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
One other con of ExecuteGlobal (which is nonetheless a valid solution) is that it is a security risk. In this case it probalby isn't an issue, but if someone put valid vbs code into the db, it would be executed as is. As I said, I doubt it is an issue, but this is why I avoid ExecuteGlobal as a matter of habit.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Dynamically Declaring Variables - 6/26/2006 5:00:30 PM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1193
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
quote:
ORIGINAL: ebgreen One other con of ExecuteGlobal (which is nonetheless a valid solution) is that it is a security risk. In this case it probalby isn't an issue, but if someone put valid vbs code into the db, it would be executed as is. As I said, I doubt it is an issue, but this is why I avoid ExecuteGlobal as a matter of habit. I don't see that as a valid concern, ebgreen. There are so MANY things in vbscript that could be construed as security risks in and of themselves, that to pull out executeglobal as the poster child, if you will, doesn't make a whole lotta sense to me. For example, say that he was trying to create some constants from various database variables: executeglobal "const ActionA = " & data teh "Const " part would totally mess that up. It would be the equivalent of me tryping out: Const ActionA = "oFSO.DeleteFolder("c:\windows")" ActionA would be construed to be the STRING containing the characters "oFSO.DeleteFolder("c:\windows")" rather than a command. He would then have to executeglobal on the Constant variable itself: executeglobal ActionA to see anykind of results. Forgive if my typing/grammer/spelling is a bit off... am under the influence of some sleeping pills, and fighting to stay up for just a couple more minutes.
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
 |
RE: Dynamically Declaring Variables - 6/26/2006 5:00:50 PM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1193
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Whoops, didn't see ehvbs' post.
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
|
|