ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old September 24th, 2003, 11:26 AM
gintom gintom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Essex, UK
Posts: 164 gintom User rank is Private First Class (20 - 50 Reputation Level)gintom User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 17 h 16 m 46 sec
Reputation Power: 5
displaying the first 20

I have an access database and users can search through it.
Is it possible to display the first 20 results on one page and then display the next 20 on another page and so on and so on..

Reply With Quote
  #2  
Old September 24th, 2003, 11:44 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Of course...anything is possible

What you ask for is called paging perhaps search google.com for code examples, trust me you'll find plenty...here type this inside google.com's textbox

"Paging using ASP"

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old September 28th, 2003, 08:49 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
hi gintom,

of course u can. here is a sample, assuming u know the basic codes already.

i used this in my asp pages. hope it works out for you.

Michael


<%
' this page is named SamePage.asp
' yr connection here
Set con = Server.CreateObject("ADODB.Connection")
...

DIM pgid, rowCount, i

pgid = trim(request.queryString("pgid"))
if pgid = "" then
pgid = 1
end if

set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorType = adOpenStatic
rs.PageSize = 20 'chg this value, this will display 20 results per page

rs.open "SELECT * from TableName", con

if not rs.eof then
if rs.recordcount <= rs.pagesize then
rs.AbsolutePage = 1
else
rs.AbsolutePage = cint(pgid)
end if
rowCount = 0
end if
%>

<html>
<body>
<table>
<%
while not rs.eof and rowCount < rs.PageSize
i = 1
abc = trim(rs("Name"))
%>
<tr>
<td><%=abc%></td>
</tr>

<%
rowCount = rowCount + 1
rs.movenext
wend
%>

<tr>
<td>Page
<%for i = 1 to rs.PageCount%>
<a href="SamePage.asp?pgid=<%=i%>"><%if Cint(pgid)=i then%><font size="2" color="#ff0000"><b><%=i%></b></font><%else%><%=i%><%end if%></a> <%if i<>rs.PageCount then%>::<%end if%><%next%></span></td>
</tr>

</table>
</body>
</html>
<!-- remember to close conenctions here -->

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > displaying the first 20


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway