lordfa9 Posted August 10, 2006 Share Posted August 10, 2006 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 More sharing options...
justsomeguy Posted August 10, 2006 Share Posted August 10, 2006 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 recordsetsWhy is that a requirement? Does the server not support ADODB?do until rs.EOFrs 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 More sharing options...
lordfa9 Posted August 10, 2006 Author Share Posted August 10, 2006 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 More sharing options...
justsomeguy Posted August 10, 2006 Share Posted August 10, 2006 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 More sharing options...
lordfa9 Posted August 11, 2006 Author Share Posted August 11, 2006 so how do i do that loop? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 11, 2006 Share Posted August 11, 2006 You will probably want to use a for loop since you know how many times it will be executing. Here is a reference:http://devguru.com/technologies/vbscript/14163.aspThe only statement in the loop will be the movenext method for the recordset, to skip to the next record. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now