|
 |
asp_databases thread: Retaining previous query results
Message #1 by slau@p... on Wed, 20 Jun 2001 16:39:25
|
|
Hi there,
My dilemna is currently this. I have a listing of records which are active
hyperlinks so they can expand on the link for more details. This listing
is generated by a query which works perfectly well.
I have a button at the bottom of the 'details' page that should take you
back to the query listing. Problem is, instead of doing that it takes me
back to the page which should contain the query listing and spits out my
error message of 'records not found.' I have already tried session
variables with no luck.
Your help is greatly appreciated.
Sandra
Message #2 by "Peter Foti (PeterF)" <PeterF@S...> on Wed, 20 Jun 2001 12:14:18 -0400
|
|
Perhaps if you posted some code someone might be able to help you
better.
-Peter
> -----Original Message-----
> From: slau@p... [mailto:slau@p...]
> Sent: Wednesday, June 20, 2001 4:39 PM
> To: ASP Databases
> Subject: [asp_databases] Retaining previous query results
>
>
> Hi there,
>
> My dilemna is currently this. I have a listing of records
> which are active
> hyperlinks so they can expand on the link for more details.
> This listing
> is generated by a query which works perfectly well.
>
> I have a button at the bottom of the 'details' page that
> should take you
> back to the query listing. Problem is, instead of doing that
> it takes me
> back to the page which should contain the query listing and
> spits out my
> error message of 'records not found.' I have already tried session
> variables with no luck.
>
> Your help is greatly appreciated.
>
> Sandra
>
Message #3 by slau@p... on Wed, 20 Jun 2001 20:06:34
|
|
It's a little difficult because it spans across pages. Anyway,
Query_results:
'***Error handling: If user entered in empty form, it will return all
results relevant to their login ID.***
if Session("QUERY_STR") <> "" then
objRS_req.Open "select Name, Request#, Estimated_Time, SE_Assigned,
Actual_Install_Date, Install_Scheduled from dbo.Orders where " & Session
("QUERY_STR"), objConn2
'objRS_req.Open "select Name, Request#, Estimated_Time, SE_Assigned,
Actual_Install_Date, Install_Scheduled from dbo.Orders where " &
query_string, objConn2
else
Response.Write "<p><center><table border = 2 cellspacing = 1
cellpadding = 1>" &_
"<tr><td align = center valign = center bgcolor = black><font size = -
1 color = 'white'><b>You have chosen to search based on your own LAN ID
because you did not fill in any fields." &_
"</b></font></td></tr></table></center><p>"
objRS_req.Open "select Name, Request#, Estimated_Time, SE_Assigned
from dbo.Orders where LAN_MS_MAIL_ID = '" & Session("USER_ID") & "'",
objConn2
end if
if objRS_req.EOF then
Response.Write "<p><b>No records were found for the specified
requirements.</b>"
else
'***Counts the records***
while not objRS_req.EOF
Num_of_records = Num_of_records + 1
objRS_req.MoveNext
wend
Response.Write "<p><b>Your search has returned " & Num_of_records
& " record(s)." &_
"<br><hr></b>"
'***Moves the filepointer back to the beginning of the list.
objRS_req.MoveFirst %>
<P><!--***Prints out results of query***-->
<table border = 0 cellpadding = 0 cellspacing = 4>
This query will print out a listing of records:
ID number, name, date scheduled, status.
If you click on the ID # it will bring up the details record, bascially a
lot of Response.Write's . Then this should take them back to the same
listing:
<form method = post action = 'query_results.asp'>
<input type = submit value = "Back to query listing">
</form>
But it doesn't, takes them back to an empty page.
Thanks,
Sandra
Message #4 by sg48@y... on Fri, 22 Jun 2001 15:46:35
|
|
When you try to go back from the details page to the page that retrieves
the stuff drom the database, you are coming from a different entrypoint
than you came from initially, so the where clause fails¨. One way of
getting around this is after you build the sql save it in a session
variable or pass it to the details page as a hidden variable. You will
need to use a session flag that tells you whether to run the sql from
scratch (when you are coming from the original page, or to use the stored
sql when returning from the details page. Hope this makes sense. Steve -
sg48@y...
|
|
 |