Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dispalying a *** RECORDS NOT FOUND *** page 2

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
Hiya all, from a novice at ASP's.

Here's my question.
How can I display a RECORDS NOT FOUND page when a user does a search and nothing is found.

I have created many ASP pages for office use and when certain criteria is not found, the page simply displays the headers for that particular page and no records. All users have grown used to just pressing back when nothing found. I would like to improve this feature.

I want to re-direct the user's results to a not found page, but I don't know how. Any help would be appreciated.

QUOTE OF THE DAY
I will prepare, and some day my chance will come.
Abraham Lincoln

<%
Jr_Clown :eek:)
%>
 
My suggestion is:

if yourSelectQuery.EOF then
response.redirect &quot;norecordfoundpage.asp&quot;
end if

hope this helps


GH
 
but I'm having a problem knowing where exactly to place the script you suggested.

Here's my code at the beginning of my page:
<%
reqfield = Request(&quot;field&quot;)
sql = &quot;Select * from names&quot;
sql = sql &amp; &quot; where first like '&quot; &amp; reqfield &amp; &quot;%' oder by last&quot;

Dim myRS
set myRS=server.createobject(&quot;ADODB.recordset&quot;)
myRS.open sql, &quot;DSN=clown&quot;
%>





Here's my code between my loop:

Beginning of my display
<%
Do While Not myRS.EOF
%>

end of my display
<%
myRS.MoveNext
LOOP
%>

Where exaclty should I put your code? Thanks







QUOTE OF THE DAY
I will prepare, and some day my chance will come.
Abraham Lincoln

<%
Jr_Clown :eek:)
%>
 
Put my code

myRS.open sql, &quot;DSN=clown&quot;
'---- redirect -----
if myRS.EOF Then
Response.Redirect &quot;urpage.asp&quot;
End if
'---- end of redirect ---

'cont. with ur code here


GH
 

YOU ARE AWESOME!!!
Thank you very very much for you help QUOTE OF THE DAY
I will prepare, and some day my chance will come.
Abraham Lincoln

<%
Jr_Clown :eek:)
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top