Use dynamic created variables in classic ASP

karev

New Member
I am creating a classic ASP page which is going to read a file and pass X while-loops containg SQL data. I need an approach for this as my method is really bad and not even working. I am thinking of doing it like this:MyInputFile.txt:\[code\]text0WHILE search="cartype=2" text1 WHILE search="cartype=31" text2 WHILE search="cartype=65" text3 WHILEEND WHILEENDWHILEENDWHILE search="cartype=90" text4WHILEEND\[/code\]This means that fx. "text0" and so is just a text that should be written to the screen but my WHILE loop should be run for as many times as I find something in my database search definition. My problem is not detecting the WHILE loop but understanding how this can be done without copy/pasting the same code 100 times as the input text file can have X nested or non-nested loops!? Especially the fact the this will not work because of the Set variable is the same:\[code\]Set res = db.Execute("SELECT * FROM sometable")While Not res.EOF Set res = db.Execute("SELECT * FROM sometable") While Not res.EOF res.MoveNext WEnd res.MoveNextWEndres.closeSet res = nothing\[/code\]I think I could make it, if ASP could create and use dynamic variables but as far as I can see this is not possible (like it is in fx PHP):\[code\]${'a' . 'b'} = 'hello there';echo $ab; // hello there\[/code\]If anyone have any good ideas, this would be very appreciated. I cannot make this in ASP.NET (no idea how to do that) but PHP would be an option, but ideally I would prefer classic ASP as PHP gives other problems as this file then cannot be utilized in our classic ASP project.
 
Top