Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Paging help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Paging help

 Post Reply Post Reply
Author
adnan248999 View Drop Down
Newbie
Newbie
Avatar

Joined: 30 November 2003
Location: United Kingdom
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote adnan248999 Quote  Post ReplyReply Direct Link To This Post Topic: Paging help
    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.

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post 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"
Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post 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

%>




Edited by fernan82
FeRnAN
Back to Top
adnan248999 View Drop Down
Newbie
Newbie
Avatar

Joined: 30 November 2003
Location: United Kingdom
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote adnan248999 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3938
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
adnan248999 View Drop Down
Newbie
Newbie
Avatar

Joined: 30 November 2003
Location: United Kingdom
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote adnan248999 Quote  Post ReplyReply Direct Link To This Post Posted: 10 December 2003 at 9:37pm
Originally posted by dpyers dpyers wrote:

 

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

 

Me niether lol

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.