| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1949 人关注过本帖
标题:asp一些实用代码
只看楼主 加入收藏
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
结帖率:76.71%
收藏
 问题点数:0 回复次数:1 
asp一些实用代码
'asp中getrows()完整分页代码
dim allcnt
'sql缓存,也可以完成分页
set rs=conn.execute("select * from XXXXX ")
'列表字段名
'For i=0 To rs.fields.count-1
'    response.write rs.fields(i).name&"("&i&")  "
    'rs.fields(i).type
'rs.fields(i).name
'next
'列表字段名
allcnt=rs.getrows(-1)
rs.close
if not IsArray(allcnt) then response.end:end if
dim p_start,p_size,p_l_f,p_countpage,p_recordcount
p_size=10 '页面显示条数
p_start=request("p_start") '获取page
if not isnumeric(p_start) or p_start="" then p_start=1 else p_start=clng(p_start) '获取页面页码
p_recordcount=ubound(allcnt,2)+1 '共有记录数据条数
p_countpage=int(p_recordcount/p_size)+1 '共有页数
if p_start<1 then p_start=1 '小于总页数
if p_start > p_countpage then p_start=p_countpage '超出总页数
p_l_f= p_size * (p_start - 1) '确定当前指针位置
dim i,j,P_rcound
P_rcound=p_l_f + p_size - 1
if P_rcound< p_recordcount-1 then P_rcound=P_rcound else P_rcound=p_recordcount-1
for i=p_l_f to P_rcound
for j=0 to ubound(allcnt,1)
response.write allcnt(j,i)&"  "
next
response.write "<BR><BR>"
next
dim p_move,p_next,p_fist,p_last '翻页代码
p_fist=1
p_last=p_countpage
if p_start>1 then p_move=p_start-1 else p_move=p_start
if p_start<p_last then p_next=p_start+1 else p_next=p_countpage
response.Write "当前在"& p_start &"页     共有记录 "
response.write p_recordcount&"  ///  <a href='?p_start="&p_fist&"'>"
response.write "第一页</a>  <a href='?p_start="&p_move&"'>上一页</a>  <a href='?p_start="&p_next&"'>"
response.write "下一页</a>  <a href='?p_start="&p_last&"'>尾页</a>"

[ 本帖最后由 ysf0181 于 2013-12-17 13:01 编辑 ]
搜索更多相关主题的帖子: request 
2013-12-17 12:53
傻黄
Rank: 2
等 级:论坛游民
帖 子:13
专家分:20
注 册:2015-6-7
收藏
得分:0 
谢谢

希望好好学习WEB开发
2015-06-08 22:51
快速回复:asp一些实用代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014578 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved