PC Review


Reply
Thread Tools Rate Thread

database results: input a session variable

 
 
=?Utf-8?B?RWRI?=
Guest
Posts: n/a
 
      9th May 2005
I want to have a database results page where the input is NOT from a form but
from a session variable defined earlier. How can I do this?

Thanks a lot,
EdH

 
Reply With Quote
 
 
 
 
Jon Spivey
Guest
Posts: n/a
 
      9th May 2005
Hi,

I think this may be a sign that you need to upgrade from the wizard to
writing your own ASP :-) As it stands the wizard can only take input from a
form or a query string, the only way I can think of to get a session var
into the results is to do something like this
<%
if request.querystring("var") = "" then
response.redirect request.servervariables("SCRIPT_NAME") & "?var=" &
session("Whatever")
end if
%>

Basically when the page is called we grab the session var and stick it on
the querystring, then we can use a query such as
select * from where Field = '::var::'

Not exactly elegant but it will get the job done

--
Cheers,
Jon
Microsoft MVP


"EdH" <(E-Mail Removed)> wrote in message
news:5A192927-E107-46F1-9927-(E-Mail Removed)...
>I want to have a database results page where the input is NOT from a form
>but
> from a session variable defined earlier. How can I do this?
>
> Thanks a lot,
> EdH
>



 
Reply With Quote
 
=?Utf-8?B?RWRI?=
Guest
Posts: n/a
 
      9th May 2005
Hi Jon. Thanks for quick response. Yes, I am trying to teach myself a crash
course in ASP, but in the meantime I have taken a bit of a large byte (pun
intended) and am trying to get a dynamic website going for a non-profit. So
far so good but ...

I understand and like your suggested solution - will worry about elegant
later. Question:

1. if I do not define a query for the DRW, then the
request.querystring("var") should always = ""? Or would it be better to add
a line before saying querystring("var")="", therefore insuring that it will
redirect the variable to my session variable?

2. would this work too: Can I look at the asp code in the database result
page, find the request querystring("var") and manually change it to
Session("whatever")?

Thanks,
Ed

"Jon Spivey" wrote:

> Hi,
>
> I think this may be a sign that you need to upgrade from the wizard to
> writing your own ASP :-) As it stands the wizard can only take input from a
> form or a query string, the only way I can think of to get a session var
> into the results is to do something like this
> <%
> if request.querystring("var") = "" then
> response.redirect request.servervariables("SCRIPT_NAME") & "?var=" &
> session("Whatever")
> end if
> %>
>
> Basically when the page is called we grab the session var and stick it on
> the querystring, then we can use a query such as
> select * from where Field = '::var::'
>
> Not exactly elegant but it will get the job done
>
> --
> Cheers,
> Jon
> Microsoft MVP
>
>
> "EdH" <(E-Mail Removed)> wrote in message
> news:5A192927-E107-46F1-9927-(E-Mail Removed)...
> >I want to have a database results page where the input is NOT from a form
> >but
> > from a session variable defined earlier. How can I do this?
> >
> > Thanks a lot,
> > EdH
> >

>
>
>

 
Reply With Quote
 
Ronx
Guest
Posts: n/a
 
      10th May 2005
Inline

--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.


"EdH" <(E-Mail Removed)> wrote in message
news:C2A912D9-B214-401F-99CB-(E-Mail Removed)...
> Hi Jon. Thanks for quick response. Yes, I am trying to teach myself
> a crash
> course in ASP, but in the meantime I have taken a bit of a large
> byte (pun
> intended) and am trying to get a dynamic website going for a
> non-profit. So
> far so good but ...
>
> I understand and like your suggested solution - will worry about
> elegant
> later. Question:
>
> 1. if I do not define a query for the DRW, then the


You should define a query within the DRW - do not add a search form to
thepage when going through the wizard.

> request.querystring("var") should always = ""?


Yes - you would link to the page as pagename.asp - no
querystring.

>Or would it be better to add
> a line before saying querystring("var")="", therefore insuring that
> it will
> redirect the variable to my session variable?


Definitely not! The script would go into a perpetual loop.
>
> 2. would this work too: Can I look at the asp code in the database
> result
> page, find the request querystring("var") and manually change it to
> Session("whatever")?


Having looked at the code, I would say Jon's script is better than
trying to amend the webbot. Jon's script works perfectly.

>
> Thanks,
> Ed
>
> "Jon Spivey" wrote:
>
>> Hi,
>>
>> I think this may be a sign that you need to upgrade from the wizard
>> to
>> writing your own ASP :-) As it stands the wizard can only take
>> input from a
>> form or a query string, the only way I can think of to get a
>> session var
>> into the results is to do something like this
>> <%
>> if request.querystring("var") = "" then
>> response.redirect request.servervariables("SCRIPT_NAME") & "?var="
>> &
>> session("Whatever")
>> end if
>> %>
>>
>> Basically when the page is called we grab the session var and stick
>> it on
>> the querystring, then we can use a query such as
>> select * from where Field = '::var::'
>>
>> Not exactly elegant but it will get the job done
>>
>> --
>> Cheers,
>> Jon
>> Microsoft MVP
>>
>>
>> "EdH" <(E-Mail Removed)> wrote in message
>> news:5A192927-E107-46F1-9927-(E-Mail Removed)...
>> >I want to have a database results page where the input is NOT from
>> >a form
>> >but
>> > from a session variable defined earlier. How can I do this?
>> >
>> > Thanks a lot,
>> > EdH
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Session Variable VS. Own-declared 'Session' Variable chowchho Microsoft ASP .NET 4 28th Mar 2008 02:07 PM
Sending ASP variable to Database Results Wizard query Michael Rothstein Microsoft Frontpage 16 24th Feb 2005 03:24 AM
Session Variable within a Database Region Ray Microsoft Frontpage 4 23rd May 2004 04:54 PM
Date ranges in database results with a defined variable Paul Microsoft Frontpage 7 25th Sep 2003 11:53 PM
Re: How to filter database results using date variable SierraCounty.info Microsoft Frontpage 5 25th Aug 2003 12:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:46 AM.