Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 August 11th, 2003, 03:16 PM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pointer within Session variable

Sorry if this is out of category, but it has been posted for 3 days without response elsewhere...looking for some help.

2 Related Questions:

Can I set a Session variable in conjunction with a hyperlink. I want to pick one of 8 schedules using a hyperlink. Each of the hyperlinks will call the same display page, but the hyperlink needs to set the session variable so I know which of the schedules to display. I am brute forcing it now by calling 1 of 8 pages that only set the session variable and then that page calls the schedule page. I am sure there must be a better way.

Once I get that session variable, I need to check another session variable for yes/no condition bases on the variable set above. Example:

From the first page, I select 1 of 8 hyperlinks. The hyperlink chosen sets the Session("ScheduleCategory") variable to one of 8 values (Acolyte, AltarGuild, Usher, Nursery, Lector, etc.). On the schedule page, I need to see if the user is a designated administrator for that particular schedule. I do that by looking at the Session variables set when the user logs in. So the passed parameter is in:

Session("ScheduleCategory") with values: Acolyte, AltarGuild, Usher, Nursery, etc

Comparison to:

Session("AcolyteAdmin") with values true/false
Session("AltarGuildAdmin") with values true/false
Session("UsherAdmin") with values true/false
Session("NurseryAdmin") with values true/false
Session("LectorAdmin") with values true/false

Etc.

So on the schedule page I need to look at the value of:

Session("xxxxAdmin")

How do I substitute the value of Session("ScheduleCategory") for the xxxx above and concatenate it with the word Admin?


__________________
Ego is a faithful friend; He stays with us all the way to the crater.
 
Old August 11th, 2003, 04:23 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I don't understand the situation completely, but it might help to know that you can use variables as well as the Session variable names. So, Session(MyVar) will work when MyVar has a value.

Then you could do something like this:

Dim MyVar
MyVar = Session("ScheduleCategory") & "admin"
Response.Write(Session(MyVar))

Does this help? If not, please be more specific about what you're trying to accomplish.

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 11th, 2003, 04:39 PM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The only references to Session variables I had found were of the format
  Session("MyVariableName")
I had found no way of substituting the contents of MyVariableName into the Session reference. Your example provided that. It is part of an If Then Else loop and the following command is the one I was searching for:

  if (Session(CheckAdmin) == 1)

I have tried the code and it works! Thanks for your help.

Rich






Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Variable youyou_hym Dreamweaver (all versions) 4 January 20th, 2005 11:48 AM
Session variable mrideout BOOK: Beginning ASP.NET 1.0 1 August 12th, 2004 07:01 PM
Session Variable mcdowell BOOK: Beginning ASP 3.0 5 June 20th, 2004 05:47 AM





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