Wrox Programmer Forums
| 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 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 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
 
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
 
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
 
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




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





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