Program | pagination | display display form:
ID NAME
1 JULIET
2 SPIRIT
3 GIRL
4 BOY
[1] [2] [3] [4] Pages: 1/4 pages 4 Records/page Total records: 13
Code:
<!--page4.asp-->
<!--#include file= "conn.asp"-->
<body bgcolor= "#FFFFFF" text= "#000000" >
<table width= "60%" border= "1" align= "Center" >
<%
Dim rs
Dim sql
Msg_per_page = 4 ' defines the number of record bars per page
Set rs = Server.CreateObject ("Adodb.recordset")
sql = "SELECT * from page ORDER by id" "Change to your own SQL statement
Rs.cursorlocation = 3 ' uses client-side cursors to improve efficiency
Rs.pagesize = Msg_per_page ' defines the number of records per page for a paging recordset
Rs.Open sql,conn,0,1
If Err.number<>0 then ' error handling
Response.Write "Database operation failed:" & Err.Description
Err.Clear
Else
If not (rs.eof and RS.BOF) Then ' detects whether the recordset is empty
Totalrec = RS. RecordCount ' Totalrec: Total number of record strips
If rs.recordcount mod msg_per_page = 0 Then ' calculates total number of pages, RecordCount: Total Records of data