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 "数据库中无数据" end if
'------------------------------------------分页开始 if rs.recordcount=0 then respose.write "没有数据" else rs.PageSize =10 '每页记录条数 iCount=rs.RecordCount '记录总数 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 page1 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