当前位置:首页 > ASP教程 > 应用技巧

asp 存储过程分页代码第1/2页

存储过程采用的是select top 加 not in的方式完成,速度也算是相当快了 我测试过了百万级数据量一般查询在1秒一下,贴出来大家交流下,看有没有什么好的建议。
简单几句话就可以实现分页功能,请看代码:
最简单使用方法(适用于任何数据表):
test.asp
复制代码 代码如下:

<!--#include file="conn.asp"-->
<!--#include file="page.asp"-->
<%
set my = new page
with my
.setconnstr=connstr '数据库链接字符串
.setstrtable="users" '表名
.setstrtext="id,username,type,names" '查询的字段
.setstrindex="id" '主键
rsarray=.getrs() '返回数据,类型为数组
end with
%>
<table>
<%
if isarray(rsarray) then
for i = 0 to ubound(rsarray, 2)
%>
<tr>
<td><%= rsarray(0, i) %></td>
<td><%= rsarray(1, i) %></td>
<td><%= rsarray(2, i) %></td>
</tr>
<%
next
end if
%>
<tr>
<td colspan="4">共<%= my.gettotalnum %>条 每页<%= my.getipagesize %>条 共<%= my.gettotalpage %>页 页码:<%= my.getfenyejmp(false) %></td>
</tr>
</table>

550)this.width=550;">
12下一页阅读全文

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!