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
Wend
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
Next
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 ..
SunLine
2003.1.10

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.