Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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
 
Old June 14th, 2004, 04:59 AM
Authorized User
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default getting asp variables dynamically

how do i get asp variables dynamically in asp? (without hardcoding)
thnks!

 
Old June 14th, 2004, 05:34 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

What do u mean by <b>asp variables dynamically in asp? </B> make it clear

Love 4 all
 
Old June 14th, 2004, 05:38 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Do you mean that you need more and more variables when you run through a loop etc. ? You can then use an array if the associated value is of normal data types (string / number).

If you want to use a series of objects, I think you cannot do it in ASP. A change in design may be needed.
 
Old June 14th, 2004, 12:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Macro_1,

Can you explain that a little more?

Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 14th, 2004, 01:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

Hmm. Something like:
varVariable = Request("var1)
eval Execute(varVariable & "=" & varValue)

I need to look into it. I'll get back to you...

 - mega
 
Old June 14th, 2004, 01:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

Jep, this works..
Code:
<%
  For i=1 To 30
    Eval Execute("varVariable" & i & " = " & i)
    Response.Write(varVariable&i & "<br>")
  Next
%>
Just out of curiosity, what are you gonna use it for?

 - mega
 
Old June 14th, 2004, 09:44 PM
Authorized User
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by marco_1
 how do i get asp variables dynamically in asp? (without hardcoding)
thnks!

sorry guys for not explaining it, i mean, how do i get asp variables (w/c are defined using Dim) dynamically without hardcoding it, i need it together w/ the server variables for error tracking if the page fails. thnks

-marco

 
Old June 15th, 2004, 12:18 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Still confusing explain that why u want to use them and with declaring variable one can how do this ?

Love 4 all
 
Old June 15th, 2004, 12:30 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

how do i get asp variables (w/c are defined using Dim) dynamically without hardcoding it, i need it together w/ the server variables for error tracking if the page fails.

If i am correct, then are u talking about arrays? For the second part, do u want to navigate through forms collection?


Om Prakash
 
Old June 15th, 2004, 12:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I think what Marco is asking is to store all the variable information be it a variable in the page, session variable or request.
So if the page fails he still has all the information?

Is this correct Marco.

If so, I don't think there is a way to loop through variables you create on the page.

You can only do your best to ensure that nothing on the page will cause an error to make the page fail. And failures other than that caused in code would prevent the saving of any variable at all at any rate.




======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling ASP.Net pages dynamically hericles ASP.NET 1.0 and 1.1 Professional 0 October 23rd, 2007 11:47 PM
Dynamically accessing ASP variables jordan147 Classic ASP Basics 1 May 21st, 2007 02:09 AM
Inserting variables into aspx pages dynamically. Grumpy ASP.NET 1.0 and 1.1 Basics 3 December 20th, 2005 08:32 AM
session variables in asp to asp.net marvz ASP.NET 2.0 Basics 0 August 1st, 2005 03:09 AM
list asp varialbes dynamically marco_1 Classic ASP Professional 2 June 14th, 2004 01:25 PM





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