Solved

Basing a query on a session variable

Posted on 2002-07-03
9
151 Views
Last Modified: 2013-12-24
I developed a page that displays data from an SQL server database. I have a session variable that identifies the user.

How can I use this variable in a where clause. The ASP code is all generated by FrontPage.
0
Comment
Question by:alexandram
9 Comments
 
LVL 12

Expert Comment

by:Wouter Boevink
ID: 7131614
Show the code please
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7133291
FrontPage isn't going to do this for you. You're going to have to edit the code yourself.
0
 

Expert Comment

by:ramesh411
ID: 7150864
Display your Code
0
 
LVL 2

Expert Comment

by:Leon Summers
ID: 7176588
Hi alexandram,

The easiest way is to post the session variable that identifies the user to the page that displays the data and then add the field into the criteria for that data. This way the query will build itself.

So when the user clicks a buttom to display the data his name is also sent along.

Or

If you wish to edit the query yourself you will need to post your data as stated by the others!!!!.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Accepted Solution

by:
PigoPigo earned 200 total points
ID: 7359310
You can modify the script that the the DRW uses to create the query to process values other than Request.Form or Request.QuerySting. You can also modify the same script to use a Session object, Application Object or Request Objects (Form, QueryString, ServerVariables, Cookies, Certificates), as follows;

Tools... Web Settings... Advanced...Show documents in hidden directories.
Open _fpclass/fpdbrgn1.inc
Find the line of code in the file about 1/3rd the way down, in the 'replace any input parameters in query string' section;
 
if len(fp_sValue) = 0 then fp_sValue = Request.QueryString(fp_sField)

Add one (or all) of these lines immediately below;
 
if len(fp_sValue) = 0 then fp_sValue = Session(fp_sField)
if len(fp_sValue) = 0 then fp_sValue = Application(fp_sField)
if len(fp_sValue) = 0 then fp_sValue = Request(fp_sField)

Use a custom DRW to query on the object by it's name. For example, use a Session Login ID (e.g. customernumber) or the Windows Logon Username (e.g. LOGON_USER) in a query;
SELECT * FROM TableName WHERE CustomerNumber = '::customernumber::'
SELECT * FROM TableName WHERE Username = '::LOGON_USER::'
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7363460
PigoPigo, it's standard procedure here to post comments, and allow the poster to decide if it's a valid answer or not. Since they haven't been back in 3 months, it's likely they either don't know how to edit/view the code, or they've forgotten about the question (or both).

And besides...
they're using FrontPage. It's highly unlikely that they'll even understand one iota of what you posted. ;-)
0
 

Expert Comment

by:PigoPigo
ID: 7371528
0
 

Expert Comment

by:PigoPigo
ID: 7371532
0
 

Expert Comment

by:PigoPigo
ID: 7371540
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now