Pagination implementation of the silly model

Source: Internet
Author: User
Just now, when I saw a netizen talking about paging, I think it was the simplest effect to create a paging function.
This section is used to open the table and assign values to the elements (saving you the need to connect to the database, please do it yourself ):
<% SQL = "........................ "
Rs. open SQL, conn, 1, 1
Rs. pagesize = 10'. This indicates that 10 records are displayed on each page.
Page = clng (request ("page") 'gets the page number value
If page = "" or page <1 then page = 1'
If page> rs. pagecount then page = rs. pagecount
Rs. AbsolutePage = page %>
Next, place the following code in the desired position to display the page turning link:
<% If page <> 1 then %> <a href = "page. asp? Page = 1 "> homepage </a> <% else %> homepage <% end if %> |
<% If page> 1 then %> <a href = "page. asp? Page = <% = page-1%> "> Previous page </a> <% else %> Previous page <% end if %> |
<% If page <rs. pagecount then %> <a href = "page. asp? Page = <% = page + 1%> "> Next page </a> <% else %> Next page <% end if %> |
<% If page <> rs. pagecount then %> <a href = "page. asp? Page = <% = rs. pagecount %> "> Last page </a> <% else %> last page <% end if %> |
Total <% = rs. pagecount %> pages/page <% = page %>/<% = rs. recordcount %> records
Then, the statement for paging is not used:
While not rs. eof
Rs. movenext
Replace with the following code:
For ipage = 1 to rs. pagesize
If rs. eof then exit for 'The Last Record jumps out of the loop
Rs. movenext
Okay, that's easy enough .. When I first started playing this game, it was a huge piece of code that made my head dizzy .. I hope it will help you.
I posted "original" here for the first time, but I don't know if I am qualified to go to the "Document Center .. Haha ..
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.