Jump to content

display 20 records per page


lordfa9

Recommended Posts

is there any way for asp to define how many records shown per page, excess records being sent to a second, third....page WITHOUT using recordsets?currently i'm using this code from w3schools to diaplay all recordsdo until rs.EOF response.write("<tr>") for each x in rs.Fields response.write("<td>" & x.value & "</td>") next rs.MoveNext response.write("</tr>")loopconn.closei think it's comething to do with loop but i'm not sure

Link to comment
Share on other sites

If your database supports it, you can use the LIMIT keyword to get exactly the records you want.SELECT * FROM table LIMIT 7, 20This will start at record 7, and get the next 20.

WITHOUT using recordsets
Why is that a requirement? Does the server not support ADODB?
do until rs.EOF
rs is a recordset, and you appear to be using it. If you know how to get a database result without using a recordset, please let me know.If your server does not support the limit keyword, you will need to manually skip ahead to the first record, and display the next 20, keeping track of how many you are showing.
Link to comment
Share on other sites

sry man about the recordset thing, i'm that kinda noob where i only learn what i need to do a proj, i dont always understand everything (much less what the code i posted is, i only know it displays everything in a table :) )

If your server does not support the limit keyword, you will need to manually skip ahead to the first record, and display the next 20, keeping track of how many you are showing.
i don't really understand this, do you mean that i have to incoporate some command that keeps track of what page i'm on?
Link to comment
Share on other sites

You will definately have to keep track of what page you're on. If you can't use limit, then you will need to have a loop that jumps ahead to the first record for the current page, and then shows the next 20 (or until there are no more).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...