This article has been tested in a hurry and supports ASP + ACCESS and ASP + SQL. Please modify the relevant sections.
Note: The answer to the basic question is declined in a hurry. This code is already very simple. If you still don't understand it, you can refer to other topics on this site.
<! -- # Include file = "conn. asp" -->
<% 'And above are database cohesion files
'-------------------------------------------- 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 the database"
End if
'------------------------------------------ Start by PAGE
If rs. recordcount = 0 then
Respose. write "no data"
Else
Rs. PageSize = 10' number of records per page
ICount = rs. RecordCount 'total number of 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