我的一个asp + sqlserver的分页程序:这个程序的特点就是指将当前页的纪录掉到页面上来。性能不错,而且不用存储过程,由于代码没有封装,所以很零散,要用到你的程序中,需要先简单读读。然后注意需要自己设置的地方的意思。有些是可以省略的。有些参数传递也是可以省略的。
代码如下:
'''' 塞北的雪 分页利器(sql server) 不用存储过程 -------------------------
'其中注释中有 ###的需要用户设置
'其中注释中有 参数传递 ** 的 说明要通过参数 传递。
'定义变量
dim toption '查询条件
dim torder '排序字符串
dim torderfield '排序字段 可通过参数获得:order_field
dim torderdirection '排序方向 可通过参数获得:order_direction
dim tpagesize '页大小
dim ttotalcount '总记录数 可通过参数获得:t_count
dim tpagecount '页数
dim tcurpage '当前页号 可通过参数获得:page
dim ttablename '表或者视图名
dim tfieldalias '行号的别名
dim tfieldlist '查询的字段列表
dim tpagefield '用于分页的字段
dim r_count '查得的记录数
set rs=server.createobject("adodb.recordset") '记录集对象
'排序处理
torderfield=request("order_field") '获得排序字段(参数传递 **)
torderdirection=request("order_dir") '获得排序方向(参数传递 **)
if(torderfield="") then torderfield="item_code" ' ### 设置默认排序字段
if(torderdirection="") then torderdirection="asc" ' ### 设置默认排序方向
'www.acnow.net
torder=" order by " & torderfield & " " & torderdirection & " " '生成排序字符串
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器