Print Page | Close Window

help on how to display 10 results per pag

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3578
Printed Date: 30 March 2026 at 4:29am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: help on how to display 10 results per pag
Posted By: amisima
Subject: help on how to display 10 results per pag
Date Posted: 16 June 2003 at 10:52am
Hi,
I have a search page using asp and I would like to know if anyone knows how to display 10 results per page with navigation for the remaning pages.

Thanks,
Amisima



Replies:
Posted By: aero
Date Posted: 16 June 2003 at 11:04am

try to make a database to this ex. then U will see how it works

filname.asp
<%
intPage = Request("Site")
If isNumeric(intPage) = False Or intPage < 1 Then
   intPage = 1
End If

Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * from SITE ORDER BY id DESC"
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("db.mdb")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
    rs.PageSize = 5
    rs.AbsolutePage = intPage
    intRecCount = rs.PageSize
    intPageCount = rs.PageCount
    Response.Write "<div><b>Site " & intPage & " Of " & intPageCount & "</b></div>"
    Do While Not rs.EOF And intRecCount > 0
%>
<table border="0" width="100%">
  <tr>
    <td width="50%"><% =rs("Name") %></td>
    <td width="50%"><% =rs("Age") %> Years</td>
  </tr>
</table>
<%
    intRecCount = intRecCount - 1
    rs.MoveNext
    Loop
End If
rs.Close
Set rs = Nothing

Response.Write "<p class=""mainbody"">Go to Site "
For intNum = 1 To intPageCount
    Response.Write "<b><a href=filname.asp?Site=" & intNum & ">" & intNum & "</a></b> "
Next

Response.Write "<p>"
If Clng(intPage) > 1 Then
    Response.Write "<a href=filname.asp?Site=" & intPage - 1 & "><b>&#8592; Back</b></a> "
Else
    Response.Write ""
End If

Response.Write "&nbsp;"
If Clng(intPage) < Clng(intPageCount) Then
    Response.Write "<a href=filname.asp?Site=" & intPage + 1 & "><b>Next &#8594;</b></a> "
Else
    Response.Write ""
End If
%>



Posted By: aero
Date Posted: 16 June 2003 at 11:05am

If u want it to show 10 results per site then changes this line

rs.PageSize = 5

to this

rs.PageSize = 10



Posted By: aero
Date Posted: 16 June 2003 at 11:08am

The database

db.mdb
SITE

id = Au. and Pri. key
name = Text
age = Number

save it and make som names in it !!!!

 

then U are running !!!!



Posted By: amisima
Date Posted: 16 June 2003 at 11:49am
Thanks for the help I will try that
AMisima


Posted By: aero
Date Posted: 16 June 2003 at 11:50am
NP



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net