PC Review


Reply
Thread Tools Rate Thread

Database Results Page

 
 
Stu
Guest
Posts: n/a
 
      11th Jun 2004
I'm using this code display results based on a number
entered into a form.

<%
ID = Request.QueryString( "ID")
if ID ="" then ID ="1"

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:mypath\mydatabase.mdb"

quote = "SELECT * FROM Results Where ID = "& ID &""
Set quote = Conn.Execute( quote)

if quote.eof then
Response.write("No records found.")
end if

%>

It works fine, but when you do a seach and there is no
record, you get this error message:

No records Found

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record.

/quote/test2view/testview.asp, line 0

How do I get rid of the error message and have it only
say "No records found"?
 
Reply With Quote
 
 
 
 
Thomas A. Rowe
Guest
Posts: n/a
 
      12th Jun 2004
Try the following format. I rarely use Response.Write to write to the browser, unless to see the
what is being passed to the Query, so you will notice use tables:


<%
ID = Request.QueryString("ID")
if ID ="" then ID ="1"

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:mypath\mydatabase.mdb"

quote = "SELECT * FROM Results Where ID = "& ID &""
Set quote = Conn.Execute( quote)
%>
<html>
<head>
<title>
</title>
</head>

<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<% If quote.eof Then %>
<tr>
<td>Sorry, No Records Found!</td>
</tr>
<% Else %>
<tr>
<td>DISPLAY FOUND RECORDS HERE</td>
</tr>
<% End If %>
</table>
</body>
</html>

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Stu" <(E-Mail Removed)> wrote in message
news:1b48e01c44fc0$024ccfc0$(E-Mail Removed)...
> I'm using this code display results based on a number
> entered into a form.
>
> <%
> ID = Request.QueryString( "ID")
> if ID ="" then ID ="1"
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.open "DRIVER={Microsoft Access Driver
> (*.mdb)};DBQ=C:mypath\mydatabase.mdb"
>
> quote = "SELECT * FROM Results Where ID = "& ID &""
> Set quote = Conn.Execute( quote)
>
> if quote.eof then
> Response.write("No records found.")
> end if
>
> %>
>
> It works fine, but when you do a seach and there is no
> record, you get this error message:
>
> No records Found
>
> ADODB.Field error '80020009'
>
> Either BOF or EOF is True, or the current record has been
> deleted. Requested operation requires a current record.
>
> /quote/test2view/testview.asp, line 0
>
> How do I get rid of the error message and have it only
> say "No records found"?



 
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
Database Results Page ChrisLouie Microsoft Frontpage 2 14th Nov 2008 08:12 PM
RE: Database Results page contains images from hyperlinks in database Wayne-I-M Microsoft Frontpage 5 8th Apr 2008 03:28 PM
Re: Database Results page contains images from hyperlinks in database Mike Mueller Microsoft Frontpage 0 5th Apr 2008 06:17 AM
ASP Database Results and Search Form page displays results upon initial entry =?Utf-8?B?RGF0YWd1cnU=?= Microsoft Frontpage 3 27th Mar 2004 06:16 PM
database results page Orman Microsoft Frontpage 1 13th Mar 2004 03:52 AM


Features
 

Advertising
 

Newsgroups
 


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