Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

How can I limit the number of records returned by ASP?

I would like to limit the number of records returned on a single page by ASP like yahoo does. ie 30 records are returned by only 10 appear per page.  I am not sure how ASP saves the records I am not listing.
0
whitej8
Asked:
whitej8
1 Solution
 
sybeCommented:
There are several ways, you can use "bookmarks" in recordsets, but it can also be done much simpler.

For the first page
========================
intMax = 30
i = 0
Do While Not RS.EOF AND i <= intMax
  Response.write RS("yourdata") & "<br>"
  i = i + 1
RS.MoveNext
Loop
=======================


For all next pages, you can have a "startvalue", which you need to pass in a querystring/form.

Something like:

intStart = Request.Querystring("startvalue")
intMax = intStart + 30

RS.Move(intStart)

intMax = 30
i = intStart
Do While Not RS.EOF AND i <= intMax
  Response.write RS("yourdata") & "<br>"
  i = i + 1
RS.MoveNext
Loop


0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now