Simple ASP Paging code (test correct) 1th/2 page _asp Basics

Source: Internet
Author: User
This article hastily has been fully tested, support asp+access and asp+sql, please modify the relevant section on it.
Note, hastily declined the basic question answer, already this code has been very simple, if you do not know can refer to other columns of this site.

<!--#include file= "conn.asp"-->
<% ' above as include database link file
'--------------------------------------------Query Start database

Set Rs=server. CreateObject ("Adodb.recordset")
Rs.Open ' select * from books where id= ' &id& ' ORDER by id Desc ', conn,1,1
If Err.number<>0 Then
Response.Write "No Data in database"
End If

'------------------------------------------paging start
If Rs.recordcount=0 Then
Respose.write "No Data"
Else
Rs. PageSize = 10 ' number of records per page
Icount=rs. RecordCount ' Total records
Ipagesize=rs. PageSize
Maxpage=rs. PageCount
Page=request ("page")

If not isnumeric (page) or page= "" Then
Page=1
Else
Page=cint (page)
End If

If Page<1 Then
Page=1
ElseIf Page>maxpage Then
Page=maxpage
End If

Rs. Absolutepage=page

If Page=maxpage Then
x=icount-(maxpage-1) *ipagesize
Else
X=ipagesize
End If

For I=1 to X
Current 1/2 page 12 Next read the full text

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.