ASP数字分页

来源:百度知道 编辑:UC知道 时间:2024/07/06 00:25:35
形式是这个:上一页 1 2 3 4 5 6 7 8 9 ... 19 20 下一页

你在百度搜索

叶子asp分页类

分页可以选择access或者mssql,听说速度是ASP分页中最快的

现在分页都用类,单独写sql语句很繁锁

<%
Set conn=Server.CreateObject("Adodb.Connection")
connstr="provider=Microsoft.JET.OLEDB.4.0;Data Source="&Server.MapPath("数据库地址")
conn.open connstr
Set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * from 表名称"
rs.open sql,conn,1,1
rs.pagesize=5
currentpage=Request.QueryString("currentpage")
rs.absolutepage=currentpage
if currentpage=1 then%>
上一页
<%else%>
<a href="?currentpage=<%=currentpage-1%>">上一页</a>
<%end if%>

<%if rs.pagecount<currentpage+1 then%>
下一页
<%else%>
<a href="?currentpage=<%=currentpage+1%>">下一页</a>
<%end if%>