Print Page | Close Window

Paging help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7895
Printed Date: 28 March 2026 at 4:07am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Paging help
Posted By: adnan248999
Subject: Paging help
Date Posted: 05 December 2003 at 9:38pm

Hi I am having a problem when trying to page through my recordset basically i have set the pagesize to 3 and all records are displayed fine except for when selecting the last page returns an error saying "Exception Occured"

So far my code is as follows:

If the number of total records exceed the pagesize limit then write the values  (for i = 1 to rs.pagesize)

Else

do until rs.eof

Now the problem here is since i have the pagesize set to 3 whenever  the total number of records is greater than 9 it will cause that error on the last page since it cannot divide equally among 3 as there are 11 records

Here is my exact code:

<%

if rsreadforum.recordcount > rsreadforum.pagesize then

for i = 1 to rsreadforum.pagesize

response.write("Write some text")

rsreadforum.movenext

next

else

do until rsreadforum.eof

response.write("Write some text")

rsreadforum.movenext

loop

end if

%>

 

Please help me out  i am restricted to having the right number of records to divide among the pagesize.



-------------
They call me Bruce Lee



Replies:
Posted By: pmormr
Date Posted: 07 December 2003 at 12:12pm
use the round function to round the result down so you don't get a decimal result... do a google search for "asp and "round" function"

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: fernan82
Date Posted: 08 December 2003 at 11:10pm
Also if you use \ instead of / to divide it you get a round number, ie:

10 \ 3 = 3
10 / 3 = 3.33....

But the thing is that you're not dividing anything there!

The problem is that recordcount always returns 11 which is more than three so it's always going on the first loop. Try this, take out the if statement and do something like this:

<%

For i = 1 to rsreadforum.pagesize

    If rsreadforum.EOF Then Exit For

    Response.Write("Write some text")

    rsreadforum.movenext

Next

%>




-------------
FeRnAN
http://www.danasoft.com/">


Posted By: adnan248999
Date Posted: 10 December 2003 at 8:29am

DUDE I hate you i really do. Cos your good hehe you found my prob immediately thanx a lot it helped i need to learn more about do, for, loop etc lol

Thanx for your help



-------------
They call me Bruce Lee


Posted By: dpyers
Date Posted: 10 December 2003 at 9:08pm

Originally posted by fernan82 fernan82 wrote:

Also if you use \ instead of / to divide it you get a round number, ie:

10 \ 3 = 3
10 / 3 = 3.33....

That's pretty cool. Never knew that - thanks.



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: adnan248999
Date Posted: 10 December 2003 at 9:37pm
Originally posted by dpyers dpyers wrote:

 

That's pretty cool. Never knew that - thanks.

 

Me niether lol



-------------
They call me Bruce Lee



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