ASP分页代码
2016-06-02 12:51
447 查看
<%'=============分页定义开始,可放在数据库打开前或后
dim action
action=request.QueryString("action")
Const
MaxPerPage=6
'定义每页显示记录数,可根据实际自定义
dim
totalPut
dim CurrentPage
dim TotalPages
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end
if
'=============分页定义结束%>
<%
'=============打开数据库数据表,要以这种方式打开
set
rs=server.CreateObject("adodb.recordset")
rs.open "select * from buyok_produc order
by ProdNum desc",conn,1,1
%>
<%'=============分页类代码开始,需放在数据库数据表打开后
if
err.number<>0 then
response.write "<p
align='center'>数据库中暂时无数据</p>"
end
if
if rs.eof And rs.bof then
Response.Write "<p
align='center'>对不起,没有符合条件记录!</p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage
totalput,MaxPerPage,""&request.ServerVariables("script_name")&""
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
showContent
showpage
totalput,MaxPerPage,""&request.ServerVariables("script_name")&""
else
currentPage=1
showContent
showpage
totalput,MaxPerPage,""&request.ServerVariables("script_name")&""
end if
end if
相关文章推荐
- ASP中LIKE模糊查
- ASP 求和(select sum(num))
- 在ASP调用script
- ASP函数大全
- 二级联动菜单——ASP+数据库版
- JS和ASP混合使用案例
- ASP判断是数字的函数
- ASP+JS三级联动下拉菜单 调用数据…
- ASP 算术运算符
- ASP中如何退出FOR循环或DO WHILE…
- asp程序错误详细说明例表
- ASP中控制文本框的隐藏和出现
- 真正解决ASP.NET每一个页面首次访问超级慢的问题 (转载)
- spring 中的<aop:advisor>和<aop:aspect>有什么区别?
- ASPNET_WEBAPI快速学习02
- Java8 Non-Heap 中的metaspace 和compressed class space解释
- Raspberry Pi3 ~ C语言控制串口
- Asp.net学习记录6--Textbox的自动完成、自动补充功能呢
- ASP.NET Core 1.0中实现文件上传的两种方式(提交表单和采用AJAX)
- ASP.NET Core管道深度剖析[共4篇]