database results: input a session variable

G

Guest

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
 
J

Jon Spivey

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
 
G

Guest

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
 
R

Ronx

Inline

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


EdH said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top