PC Review


Reply
Thread Tools Rate Thread

asp results page

 
 
Stu
Guest
Posts: n/a
 
      14th Jun 2004
I'm using this code to display results from a database:

<%
companyname = Request.QueryString( "companyname")





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

quote = "SELECT * FROM Results WHERE company LIKE '%"&
companyname &"%'"

Set quote = Conn.Execute( quote)

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


%>

The problem I'm having is I'm searching for a company name
and there are more than one record with the same company
name but my results page will only display one record.
Also I'm displaying more fields than just the company
name, but company name is what field is used in the
query. All the fields together are formatted to make up a
quote form. I need this code to display all the records
not just the first one it comes to...and all the other
fields with it. The frontpage database results wizard
does this when you select how many records you want
displayed at one time. If you select 1 then a nav bar is
created at the bottom of the results page to take you to
the next record...this is what I'm trying to
accomplish...but without using the wizard...please help
 
Reply With Quote
 
 
 
 
Jon Spivey
Guest
Posts: n/a
 
      14th Jun 2004
Hi Stu,

You need to loop through the results, eg

<%
sql="select * from table where company like '%" & companyname & "%'"
set quote = conn.execute(sql)
if not quote.eof then
do until quote.eof
response.write quote(0) & "<BR>"
quote.movenext
loop
else
response.write "no results"
end if
%>

Hopefully that will get you started

--
Cheers,
Jon
Microsoft MVP - FP

"Stu" <(E-Mail Removed)> wrote in message
news:1bed001c45227$bd94e330$(E-Mail Removed)...
> I'm using this code to display results from a database:
>
> <%
> companyname = Request.QueryString( "companyname")
>
>
>
>
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.open "DRIVER={Microsoft Access Driver
> (*.mdb)};DBQ=C:mypath\mydatabase.mdb"
>
> quote = "SELECT * FROM Results WHERE company LIKE '%"&
> companyname &"%'"
>
> Set quote = Conn.Execute( quote)
>
> if quote.eof then
> Response.write("No records found.")
> Response.End
> end if
>
>
> %>
>
> The problem I'm having is I'm searching for a company name
> and there are more than one record with the same company
> name but my results page will only display one record.
> Also I'm displaying more fields than just the company
> name, but company name is what field is used in the
> query. All the fields together are formatted to make up a
> quote form. I need this code to display all the records
> not just the first one it comes to...and all the other
> fields with it. The frontpage database results wizard
> does this when you select how many records you want
> displayed at one time. If you select 1 then a nav bar is
> created at the bottom of the results page to take you to
> the next record...this is what I'm trying to
> accomplish...but without using the wizard...please help



 
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
results page submission page edit page =?Utf-8?B?Z2xlc2dh?= Microsoft Frontpage 1 12th Jan 2006 10:57 AM
Search Form Results, send results to new page =?Utf-8?B?Q2FwdGFpbiBDYXJs?= Microsoft Frontpage 2 1st Aug 2005 07:13 PM
Using open to view htm page results in bold, left aligned page he. =?Utf-8?B?R2lhcyBHb2tlbnQ=?= Microsoft Frontpage 1 6th Apr 2005 04:36 PM
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
Formating a Results page in FP2K & adding info to results MysticKnight Microsoft Frontpage 1 22nd Dec 2003 01:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:40 PM.