| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 358 人关注过本帖
标题:[求助]i一个不能正确显示分页的代码
只看楼主 加入收藏
zln
Rank: 1
等 级:新手上路
帖 子:73
专家分:0
注 册:2006-1-6
收藏
 问题点数:0 回复次数:2 
[求助]i一个不能正确显示分页的代码

<!--#include file="conn.asp"-->

<%dim rs1,ipage
set rs1=server.createobject("adodb.recordset")
sql="select * from tijianjilu"
rs1.open sql,conn,3
rs1.pagesize=1
if request("page")<>""then
ipage=cint(request("page"))
else
ipage=1
end if
response.write("当前第"&ipage&"页")
rs1.absolutepage=ipage
%>




If Not rs.eof then

%>

<table width="1253" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="55" height="20" align="center">工资卡号</td>
<td width="54" height="20" align="center">体检年度</td>

<td width="59" height="20" align="center">心脏</td>





</tr>
<%
for i=0 to rs.pagesize-1
if rs.eof or rs.bof then exit for%>

<%do while not rs.eof%>
<tr>
<td width="55" height="20" align="center"><%=rs("Tijiandanhao")%></td>
<td width="54" height="20" align="center"><%=rs("Tijianshijian")%></td>
<td width="59" height="20" align="center"><%=replace(rs("xin")&"",",","")%></td>


<% rs.movenext
loop
next
%>

%>
</tr>
</table>
<br>
<%else%>
<table width="4610" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="1217" align="center">
<%
Response.Write("没有找到相关记录!!")
%></td>
</tr>
</table>
<br>
<a href="#">第一页</A><A HREF="viewrecord.asp?page=<%=ipage-1%>">上一页</a>
<a href="viewrecord.asp? page=<%=ipage+1%>">下一页</a><a href="#">最后页</a>
<%end if
rs.close
set rs = nothing
conn.close
set conn = nothing
%>

搜索更多相关主题的帖子: 代码 
2006-06-09 10:51
piaoxue
Rank: 3Rank: 3
来 自:地球
等 级:论坛游侠
威 望:3
帖 子:606
专家分:113
注 册:2005-9-19
收藏
得分:0 

我自己写了一个分页的代码,特别简单。看看吧!
<%
'***********************分页******************
dim page_size
dim page_no
dim page_total
dim wenjianming
wenjianming="a.asp"
page_size=10
if request.querystring("page_no")="" then
page_no=1
else
page_no=cint(request.querystring("page_no"))
end if
rs.pagesize=page_size
page_total=rs.pagecount
if not(rs.bof or rs.eof) then
rs.absolutepage=page_no
end if
dim i
i=page_size
%>


<%
if page_total=1 then
response.write "首页|上一页|下一页|尾页"
else
response.write "<a href=" & wenjianming & "?page_no=1>首页</a>|"
if page_no-1>0 then
response.write "<a href=" & wenjianming & "?page_no=" & page_no-1 & ">上一页</a>|"
else
response.write "上一页|"
end if
if page_no+1<=page_total then
response.write "<a href=" & wenjianming & "?page_no=" & page_no+1 & ">下一页</a>|"
else
response.write "下一页|"
end if
response.write "<a href=" & wenjianming & "?page_no=" & page_total & ">尾页</a>"
end if
'*****************************************
%>
<table width="90%" border="0">
<tr bgcolor="#b7b7b7" align="center">
<td width="10%" >姓名 </td>
<td width="20%">电话</td>
<td width="30%">Email</td>
<td width="20%">住址</td>
<td width="20%">备注</td>
</tr>
<%
do while not rs.eof and i>0
i=i-1
%>
<tr bgcolor="#00ccff" align="center">
<th ><div align="center"><%=rs("xingming")%></div></th>
<td><div align="center"><%=rs("dianhua")%></div></td>
<td><div align="center"><%=rs("youxiang")%></div></td>
<td><div align="center"><%=rs("zhuzhi")%></div></td>
<td><div align="center"><%=rs("beizhu")%></div></td>
</tr>
<%
rs.movenext
loop
%>


我是做平面设计、网站制作、网站推广、主机域名等业务的站长。有需要的给我站内信吧。
2006-06-09 13:04
mamu123456
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2006-6-5
收藏
得分:0 

<%
Connstr="DBQ="+server.mappath("sss/main.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};DriverId=25;"
set conn=server.createobject("adodb.connection")
conn.open Connstr

sqlstr="select * from lyd_images order by lyd_img_01 desc"
set rs=server.createobject("adodb.recordset")
rs.open sqlstr,conn,1,3
dim intrec
dim nowpage
const adopenstatic=3
const adlockreadonly=1
const adcmdtable=2
cursortype=adopenstatic
locktype=adlockreadonly
set rs=server.createobject("adodb.recordset")
rs.open sqlstr,conn,cursortype,locktype,options
if rs.eof then
response.redirect "error.asp"
end if
dim counter,howpage
rs.pagesize=4
thesize=rs.pagesize
counter=rs.RecordCount
howpage=rs.pagecount
dim thecursor

If Request.QueryString("PAGE")=""Then
session("intPage")=1
Else
If session("intPage")<1 Then
session("intPage")=1
Else
If session("intPage")>rs.PageCount Then
session("intPage")=rs.PageCount
Else
nowpage=request("page")
session("intPage")=CInt(nowpage)
End If
End If
End If

rs.AbsolutePage=session("intPage")
thispage=rs.absolutepage%>
共有 <font color="#FF0000"><%=rs.pagecount%></font> 页 <font color="#FF0000"><%=counter%></font>
个系列&nbsp;当前第 <font color="#FF0000"><%=session("intpage")%></font>
页&nbsp;      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%if rs.pagecount>1 then%>
<a href="zuopizhanshi.asp?page=1" class="top1">首页</a>
<% end if%>
<%if session("intpage")>1 then%>
<a href="zuopizhanshi.asp?page=<%=session("intPage")-1%>" class="top1">上页</a>
<%
end if%>
<%if session("intpage")<rs.pagecount then%>
<a href="zuopizhanshi.asp?page=<%=session("intPage")+1%>" class="top1">下页</a>
<%
end if%>
<%if rs.pagecount>1 then%>
<a href="zuopizhanshi.asp?page=<%=rs.pagecount%>" class="top1">末页</a>
<%
end if%>
<div align="center">
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class=fame5 valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" >
<tr>
<td height="2" valign="top" width="98%"> <table border=0 width="100%" cellpadding="7" cellspacing="12">
<%if not rs.eof then
dim i
i = 1
while not rs.eof and i<rs.pagesize+1%>
<%if (i mod 2)=1 then%>
<tr class="bodystyle">
<td width="50%" valign="top"> <div align="left" class="style6">
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td height="81" valign="top"> <div align="center">
<p><a href="zuopinzhanshi1.asp?lyd_img_01=<%=rs("lyd_img_01")%>" target="_blank"><img src="sss/<%=rs("lyd_img_05")%>" width="90" height="90" border="0" ></a>
</p>
</div></td>
</tr>
<tr>
<td valign="top"><div align="center"><a href="zuopinzhanshi1.asp?lyd_img_01=<%=rs("lyd_img_01")%>" target="_blank"><%=rs("lyd_img_03")%></a></div></td>
</tr>
<tr> </tr>
</table>
<%
i=i+1
rs.movenext
%>
<%else%>
</div>
<td width="50%" valign="top"> <div align="left" class="style6">
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td valign="top"> <div align="center">
<p><a href="zuopinzhanshi1.asp?lyd_img_01=<%=rs("lyd_img_01")%>" target="_blank"><img src="sss/<%=rs("lyd_img_05")%>" width="90" height="90" border="0" ></a></p>
</div></td>
</tr>
<tr>
<td valign="top"><div align="center"><a href="zuopinzhanshi1.asp?lyd_img_01=<%=rs("lyd_img_01")%>" target="_blank"><%=rs("lyd_img_03")%></a></div></td>
</tr>
<tr> </tr>
</table>
<%
i=i+1
rs.movenext
%>
<%end if%>
<%wend
else%>
<%response.write "no results:("%>
<%end if%>
</div></table></td>
</tr>
</table></td>
</tr>
</table>
<div align="right">
<%
rs.close
set rs=nothing
conn.close
set conn=nothing

%>

2006-06-10 10:00
快速回复:[求助]i一个不能正确显示分页的代码
数据加载中...
 
   



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

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