Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 13th, 2004, 01:07 AM
Authorized User
 
Join Date: Jun 2003
Location: Melbourne, Victoria, Australia.
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default Create a dynamic variable from a recordset

Hi Everyone,

I think this an easy one.

What i have is a subscription page which loops though their subscribed categories. What i want to do is have a variable called show1250 = "tick"
(where the 1250 is the objRS("CatID") value )
I cant join the show and the objRS("CatName") together.

eg.

Do While Not objRS.EOF

Response.Write objRS("CatName")
' This bit i cant get right joining the show and the objRS("CatName")
"show" + objRS("CatName") = "ticked"

objRS.MoveNext
Loop

This way when i grab all the subscription categories later on down the page i can just do a check in my loop where or not to tick the check box or leave it unticked.

Thanks for you help

Tim

TDA
__________________
TDA
Reply With Quote
  #2 (permalink)  
Old May 13th, 2004, 06:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

what is there in objRS("CatName") actually?

You can try that replacing "+" with "&"

"show" & objRS("CatName") = "ticked"
Response.write "show" & objRS("CatName")

If you get the output as ticked, then you are through.

Cheers!

-Vijay G
Reply With Quote
  #3 (permalink)  
Old May 13th, 2004, 06:40 PM
Authorized User
 
Join Date: Jun 2003
Location: Melbourne, Victoria, Australia.
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default

Still get a syntax error.

Basically i want create a variable name that joins the string "show" and the CatName (Category Name) together as a variable name. so later on down the page when i loop through all the categories i can determine wheather or not to have the check box ticked or not with some simple logic.

Thanks

Tim

TDA
Reply With Quote
  #4 (permalink)  
Old May 13th, 2004, 11:04 PM
Authorized User
 
Join Date: Jun 2003
Location: Melbourne, Victoria, Australia.
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default

It's really strange because i can do it if i use a session variable but i doesn't work for just a normal variable.

eg.

Session("show"& objSub("CatName") ) = objSub("CatName")

Works and creates session variables such as

showTennis
showGolf
ect....

But i just want to create normal variables.

Any help would be appreciated

Tim

TDA
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable used in recordset field name the4barkersab Access VBA 1 February 24th, 2008 04:18 PM
Changeing a Recordset Name With a Variable? Winners Access VBA 2 August 22nd, 2007 02:10 PM
Create Variable when needed (dynamic) mkhan SQL Server 2000 1 February 22nd, 2006 11:01 PM
Dynamic Recordset chiefouko VB Databases Basics 1 December 15th, 2003 07:54 AM



All times are GMT -4. The time now is 07:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.