A summary of several algorithms for calculating the total number of pages in ASP page-application Tips

Source: Internet
Author: User
Here's how to calculate the total number of pages when I find three ASP pages from the Web, this method calculates the total number of pages when paging, not the entire paging code:
Method One
Copy Code code as follows:

' Htmer_recordcount the total number of pages to be calculated
' Htmer_recordcount is the number of recordsets
' Htmer_pagesize the number of records per page
If htmer_recordcount Mod htmer_pagesize=0 Then
Htmer_pagecount=int (Htmer_recordcount/htmer_pagesize)
Else
Htmer_pagecount=int (htmer_recordcount/htmer_pagesize) +1
End If

Method Two
Copy Code code as follows:

' Htmer_recordcount the total number of pages to be calculated
' Htmer_recordcount is the number of recordsets
' Htmer_pagesize the number of records per page
Htmer_pagecount=int (htmer_recordcount/htmer_pagesize*-1) *-1

Method Three
Copy Code code as follows:

' Htmer_recordcount the total number of pages to be calculated
' Htmer_recordcount is the number of recordsets
' Htmer_pagesize the number of records per page
Htmer_pagecount=abs (Int (-(htmer_recordcount/htmer_pagesize))

Method Four
Copy Code code as follows:

' Htmer_recordcount the total number of pages to be calculated
' Htmer_recordcount is the number of recordsets
' Htmer_pagesize the number of records per page
Htmer_pagecount=fix (htmer_recordcount/htmer_pagesize)-cint (CBool (htmer_recordcount Mod HTMer_PageSize))
Related Article

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.