Connecting Tech Pros Worldwide Forums | Help | Site Map

Limiting number of records returned

Mettá
Guest
 
Posts: n/a
#1: Jul 19 '05
I was given the basics of the code below to display an Access DB. Can anyone
tell me how to limit the number of db records that come up using the code
below...

Thanks
M

<%Dim DSN_NameX
DSN_NameX = Application("dbNAME_ConnectionString")
set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_NameX
Search1=Request("Descript")
Search2=Request("County")
Search3=Request("Pc1")

Set RSCat = Server.CreateObject("ADODB.RecordSet")
SQL = "SELECT
id,Name,Descript,address1,address2,address3,Town,P ost_Code,tel,fax,web,pi
ctu,email FROM dbNAME WHERE (Descript LIKE '%"&Search1& "%' AND County
LIKE '%" &Search2& "%' AND Pc1 LIKE '%" &Search3& "%') ORDER BY Name"
RSCat.Open SQL, Connection
%>
<% while NOT RSCat.EOF %>

<table> SNIP

<%=RSCat("Name")%>
<%=RSCat("Descript")%>
<%=RSCat("pictu")%>
<%=RSCat("Address1")%>
<%=RSCat("Address2")%>
<%=RSCat("Address3")%>
<%=RSCat("Town")%>
<%=RSCat("Post_Code")%>
T:<%=RSCat("Tel")%>
F:<%=RSCat("Fax")%>
<%=RSCat("Email")%>
<%=RSCat("Web")%> <%=RSCat("id")%>

SNIP </table>

<%
RSCat.MoveNext
wend
RSCat.Close
%>







Maarten
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Limiting number of records returned


SQL = "SELECT TOP 10
id,Name,Descript,address1,address2,address3,Town,P ost_Code,tel,fax,web,pi


Mettá
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Limiting number of records returned


Thanks worked just fine...

Next question... how to get say top 5 and then option to click for more and
see next 5 or less remaining...

M


"Maarten" <nobody@pandora.be> wrote in message
news:X0U7c.46328$J52.3307614@phobos.telenet-ops.be...[color=blue]
> SQL = "SELECT TOP 10
> id,Name,Descript,address1,address2,address3,Town,P ost_Code,tel,fax,web,pi
>
>[/color]


Ray at
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Limiting number of records returned


Best start new threads for new questions, but see here.

http://www.aspfaq.com/show.asp?id=2120

Ray at work

"Mettá" <metta@re-movethis-metta.org.uk> wrote in message
news:%23dPs4hOEEHA.3404@TK2MSFTNGP10.phx.gbl...[color=blue]
> Thanks worked just fine...
>
> Next question... how to get say top 5 and then option to click for more[/color]
and[color=blue]
> see next 5 or less remaining...
>
> M
>
>
> "Maarten" <nobody@pandora.be> wrote in message
> news:X0U7c.46328$J52.3307614@phobos.telenet-ops.be...[color=green]
> > SQL = "SELECT TOP 10
> >[/color][/color]
id,Name,Descript,address1,address2,address3,Town,P ost_Code,tel,fax,web,pi[color=blue][color=green]
> >
> >[/color]
>
>[/color]


Closed Thread