|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
showing 25 rows of a table in each page
<i><b>Originally posted by : yaron (yaron_kh@yahoo.com)</b></i><br />hello<br /><br />i'm trying to show 25 rows of a table in a one page and with the NEXT button show the next 25 rows and so on.<br /><br /><br />what is a good way (minimal use of resources)<br />to do that?<br /><br />i don't want to leave an open connection to the database.<br /><br />thanks<br />yaron
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Greg (gregdirst@yahooNOSPAM.com)</b></i><br /><br />Hi,<br /><br />You can do it in many ways, but this is one I recommend.<br /><br /><br />Loop through the recordset from the beginning point through the next 25 records or EOF. Before you end the form add a hidden input field (or you can use a query string) and save the absolute position of where you left off. When the user clicks next then post the page (or let the query string pass the absolute position you left off) and the next time the page draws you simple do a move first then loop through the next 25 or EOF.<br /><br />Hope this helps. Code sample below.<br /><br />Greg<br /><br /><%<br /> Dim lStartPosition, _<br /> bDone<br /><br /> '--determine where to start<br /> if not isempty(request("startat")) then<br /> lStartPosition = request("startat")<br /> rs.move lStartPosition<br /> else<br /> lStartPosition = 0<br /> end if<br /><br /> '--do loop<br /> do while not rs.eof And Not bDone<br /> bDone = cbool(rs.absoluteposition = (lStartPosition + 25))<br /> rs.move next<br /> loop<br />%><br /><br />------------<br />yaron at 2/18/2002 12:30:10 PM<br /><br />hello<br /><br />i'm trying to show 25 rows of a table in a one page and with the NEXT button show the next 25 rows and so on.<br /><br /><br />what is a good way (minimal use of resources)<br />to do that?<br /><br />i don't want to leave an open connection to the database.<br /><br />thanks<br />yaron
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : Greg</b></i><br /><br />BTW, you will connect from the data before the code and disconnect after it on each page refresh.<br /><br />------------<br />Greg at 2/19/2002 8:56:10 AM<br /><br /><br />Hi,<br /><br />You can do it in many ways, but this is one I recommend.<br /><br /><br />Loop through the recordset from the beginning point through the next 25 records or EOF. Before you end the form add a hidden input field (or you can use a query string) and save the absolute position of where you left off. When the user clicks next then post the page (or let the query string pass the absolute position you left off) and the next time the page draws you simple do a move first then loop through the next 25 or EOF.<br /><br />Hope this helps. Code sample below.<br /><br />Greg<br /><br /><%<br /> Dim lStartPosition, _<br /> bDone<br /><br /> '--determine where to start<br /> if not isempty(request("startat")) then<br /> lStartPosition = request("startat")<br /> rs.move lStartPosition<br /> else<br /> lStartPosition = 0<br /> end if<br /><br /> '--do loop<br /> do while not rs.eof And Not bDone<br /> bDone = cbool(rs.absoluteposition = (lStartPosition + 25))<br /> rs.move next<br /> loop<br />%><br /><br />------------<br />yaron at 2/18/2002 12:30:10 PM<br /><br />hello<br /><br />i'm trying to show 25 rows of a table in a one page and with the NEXT button show the next 25 rows and so on.<br /><br /><br />what is a good way (minimal use of resources)<br />to do that?<br /><br />i don't want to leave an open connection to the database.<br /><br />thanks<br />yaron
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > showing 25 rows of a table in each page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|