| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 566 人关注过本帖
标题:请帮忙加入分页代码
取消只看楼主 加入收藏
a190066
Rank: 4
等 级:业余侠客
威 望:2
帖 子:175
专家分:204
注 册:2010-6-24
结帖率:79.07%
收藏
已结贴  问题点数:20 回复次数:3 
请帮忙加入分页代码
<div align="center">
〈%
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews"
rs.open sql,cn,1,1
s=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where upup=1"
rs.open sql,cn,1,1
s1=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where downdown=1"
rs.open sql,cn,1,1
s2=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where jiajia=1"
rs.open sql,cn,1,1
s3=rs.recordcount
rs.close
set rs=nothing
%〉
<table width="61%" border="0" cellspacing="0" cellpadding="0">
  <tr align="center" valign="bottom">
    <td width="19%" height="20">总人数</td>
    <td width="23%">上班签到人数</td>
    <td width="29%">下班登记人数</td>
    <td width="29%">请假外出人数</td>
  </tr>
  <tr align="center">
    <td>〈%=s%〉</td>
    <td>〈%=s1%〉</td>
    <td>〈%=s2%〉</td>
    <td>〈%=s3%〉</td>
  </tr>
  <tr align="center" valign="bottom">
    <td height="188">百分比</td>
    <td height="188"><div style="background-color:#98C9D6; width: 20px; height: 〈%=(s1/s)*30%〉px;"></div></td>
    <td height="188"><div style="background-color:#98C9D6; width: 20px; height: 〈%=(s2/s)*30%〉px;"></div></td>
    <td height="188"><div style="background-color:#98C9D6; width: 20px; height: 〈%=(s3/s)*30%〉px;"></div></td>
  </tr>
</table>
<hr size="2px" color="#218FF3">

<table width="61%" border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
    <td width="19%">账户</td>
    <td width="23%">上班签到</td>
    <td width="29%">下班登记</td>
    <td width="29%">请假外出</td>
  </tr>
<!需要在此开始分页->
  〈%
  set rs=cn.execute("select * from scunews")
  do while not rs.eof
  %〉
  <tr align="center">
    <td align="left">&nbsp;&nbsp;&nbsp;&nbsp;〈%=rs("username")%〉</td>
    <td><div id="div1">
      〈%if rs("upup")=0 then%〉
      <a href="?act=upup&id=〈%=rs("id")%〉"><font color="#FF0000">未签到</font></a>
      〈%else%〉
      <a href="?key=upup&id=〈%=rs("id")%〉">已签到</a>
      〈%end if%〉
    </div></td>
    <td>〈%if rs("downdown")=0 then%〉
      <a href="?act=downdown&id=〈%=rs("id")%〉">未登记</a>
        〈%else%〉
        <a href="?key=downdown&id=〈%=rs("id")%〉"><font color="#FF0000">已登记</font></a>
      〈%end if%〉</td>
    <td><div id="div">
      〈%if rs("jiajia")=0 then%〉
      <a href="?act=jiajia&id=〈%=rs("id")%〉">未请假</a>
      〈%else%〉
      <a href="?key=jiajia&id=〈%=rs("id")%〉"><font color="#FF0000">已请假</font></a>
      〈%end if%〉
    </div></td>
  </tr>
  〈%
  rs.movenext
  loop
  conn.close
  %〉
</table>
〈%
id=request("id")
if request("act")<>"" then
set rs=cn.execute("update scunews set "&request("act")&"=1 where id="&id&"")
conn.close
response.Redirect("qiandao_look.asp")
end if
if request("key")<>"" then
set rs=cn.execute("update scunews set "&request("key")&"=0 where id="&id&"")
conn.close
response.Redirect("qiandao_look.asp")
end if
%〉
</div>
搜索更多相关主题的帖子: 代码 
2010-07-11 17:20
a190066
Rank: 4
等 级:业余侠客
威 望:2
帖 子:175
专家分:204
注 册:2010-6-24
收藏
得分:0 
回复 楼主 a190066
在原代码上加入分页代码出现错误,请高手指教。
<!--#include file="conn.asp"-->
<div align="center">
<%
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews"
rs.open sql,cn,1,1
s=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where upup=1"
rs.open sql,cn,1,1
s1=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where downdown=1"
rs.open sql,cn,1,1
s2=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where jiajia=1"
rs.open sql,cn,1,1
s3=rs.recordcount
rs.close
set rs=nothing
%>

<%
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select * from scunews order by username_ID desc"
rs.PageSize = 20 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
<table width="61%" border="0" cellspacing="0" cellpadding="0">
  <tr align="center" valign="bottom">
    <td width="19%" height="20">总人数</td>
    <td width="23%">上班签到人数</td>
    <td width="29%">下班登记人数</td>
    <td width="29%">请假外出人数</td>
  </tr>
  <tr align="center">
    <td><%=s%></td>
    <td><%=s1%></td>
    <td><%=s2%></td>
    <td><%=s3%></td>
  </tr>
  <tr align="center" valign="bottom">
    <td height="310">百分比</td>
    <td height="310"><div style="background-color:#98C9D6; width: 20px; height: <%=(s1/s)*30%>px;"></div></td>
    <td height="310"><div style="background-color:#98C9D6; width: 20px; height: <%=(s2/s)*30%>px;"></div></td>
    <td height="310"><div style="background-color:#98C9D6; width: 20px; height: <%=(s3/s)*30%>px;"></div></td>
  </tr>
</table>
<hr size="2px" color="#218FF3">

<table width="61%" border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
    <td width="19%">账户</td>
    <td width="23%">上班签到</td>
    <td width="29%">下班登记</td>
    <td width="29%">请假外出</td>
  </tr>

 <%
  set rs=cn.execute("select * from scunews")
  do while not rs.eof
  %>

  <%
  set rs=cn.execute("select * from scunews")
  do while not rs.eof
  %>
 
  <tr align="center">
    <td align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%=rs("username")%></td>
    <td><div id="div1">
      <%if rs("upup")=0 then%>
      <a href="?act=upup&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
      <%else%>
      <a href="?key=upup&id=<%=rs("id")%>">已签到</a>
      <%end if%>
    </div></td>
    <td><%if rs("downdown")=0 then%>
      <a href="?act=downdown&id=<%=rs("id")%>">未登记</a>
        <%else%>
        <a href="?key=downdown&id=<%=rs("id")%>"><font color="#FF0000">已登记</font></a>
      <%end if%></td>
    <td><div id="div">
      <%if rs("jiajia")=0 then%>
      <a href="?act=jiajia&id=<%=rs("id")%>">未请假</a>
      <%else%>
      <a href="?key=jiajia&id=<%=rs("id")%>"><font color="#FF0000">已请假</font></a>
      <%end if%>
    </div></td>
  </tr>

 <%
  rs.movenext
  loop
  conn.close
  %>
</table>

<%
id=request("id")
if request("act")<>"" then
set rs=cn.execute("update scunews set "&request("act")&"=1 where id="&id&"")
conn.close
response.Redirect("qiandao_look.asp")
end if
if request("key")<>"" then
set rs=cn.execute("update scunews set "&request("key")&"=0 where id="&id&"")
conn.close
response.Redirect("qiandao_look.asp")
end if
%>

<table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="document_manage.asp?page=1">首页</a>|
<%if pre then%>
<a href="document_manage.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="document_manage.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
<a href="document_manage.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="document_manage.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="document_manage.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font></td></tr></table></div>

2010-07-12 12:05
a190066
Rank: 4
等 级:业余侠客
威 望:2
帖 子:175
专家分:204
注 册:2010-6-24
收藏
得分:0 
以下代码可显示分页码,有上一页、下一页提示。但修改“rs.pagesize=10”此数实际上不能改页码数,还是显示超过10行以上的内容。实际上没有分页。请高手指教!谢谢

<!--#include file="conn2.asp"-->
<link href=font.css rel=stylesheet>
<div align="center">

<%
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews"
rs.open sql,cn,1,1
s=rs.recordcount
rs.close
set rs=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where up1=1"
rs.open sql,cn,1,1
s=rs.recordcount
rs.close
set rs=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where up2=1"
rs.open sql,cn,1,1
s1=rs.recordcount
rs.close
set rs=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where up3=1"
rs.open sql,cn,1,1
s2=rs.recordcount
rs.close
set rs=nothing
%>

<div align="center"><center>
<table border="1" borderColor="#000000" cellPadding="0"
style="border-collapse: collapse; border-bottom: medium none" width="100%" cellspacing="1">

 

  <tr>
    <td width="6%" align="center"><b><font color="#FF0000"><%=s%></font></b><font color="#800000">次</font></td>
    <td width="6%" align="center"><font color="#FF0000"><b><%=s1%></font></b><font color="#800000">次</font></td>
    <td width="6%" align="center"><font color="#FF0000"><b><%=s2%></font></b><font color="#800000">次</font></td>
  </tr>
 
</table>
<hr size="1px" color="#218FF3">

<%
dim page
page=Clng(request("page"))
rs.pagesize=10'此值设置十行一页但修改此数实际上不能改页码数,请高手指教!谢谢
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
%>

<div align="center"><center>
<table border="1" borderColor="#000000" cellPadding="0"
style="border-collapse: collapse; border-bottom: medium none" width="100%" cellspacing="1">

 
<%
for i=1 to rs.pagesize
%>

  <%
  set rs=cn.execute("select * from scunews")
  do while not rs.eof
  %>

  <tr align="center">

    <td width="6%" align="center"><div id="div1">
      <%if rs("up1")=0 then%>
      <a href="?act=up1&id=<%=rs("id")%>">已签到</a>
      <%else%>
      <a href="?key=up1&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
      <%end if%>
    </div></td>

    <td width="6%" align="center"><%if rs("up2")=0 then%>
      <a href="?act=up2&id=<%=rs("id")%>">已签到</a>
        <%else%>
        <a href="?key=up2&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
      <%end if%></td>

    <td width="6%" align="center"><div id="div">
      <%if rs("up3")=0 then%>
      <a href="?act=up3&id=<%=rs("id")%>">已签到</a>
      <%else%>
      <a href="?key=up3&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
      <%end if%>
    </div></td>
  </tr>

  <%
  rs.movenext
  loop
  conn.close
  %>

</table>
</div>

<%
id=request("id")
if request("act")<>"" then
set rs=cn.execute("update scunews set "&request("act")&"=1 where id="&id&"")
conn.close
response.Redirect("2index.asp")
end if
if request("key")<>"" then
set rs=cn.execute("update scunews set "&request("key")&"=0 where id="&id&"")
conn.close
response.Redirect("2index.asp")
end if
%>
<%
rs.movenext
if rs.eof then exit for
next
%>
<%
if page<>1 then
response.write "<a href=2index.asp?page=1>首页</a> "
response.write "<a href=2index.asp?page="&(page-1)&">上一页</a> "
end if
if page<>rs.pagecount then
response.write "<a href=2index.asp?page="&(page+1)&">下一页</a> "
response.write "<a href=2index.asp?page="&rs.pagecount&">尾页</a> "
end if
%>

</div>


[ 本帖最后由 a190066 于 2010-7-12 14:06 编辑 ]
2010-07-12 14:05
a190066
Rank: 4
等 级:业余侠客
威 望:2
帖 子:175
专家分:204
注 册:2010-6-24
收藏
得分:0 
回复 4楼 a190066
不行哟。设定十行的。但超过13行还是显示13行。我就是想不通。再帮我查查。谢谢。

我再把数据库的相关二个文件传上来,请高手查对一下。
Question.rar包含如下文件:
Question.rar (9.73 KB)

2index.asp
conn.asp
font.css
pingfen.mdb (188KB)


[ 本帖最后由 a190066 于 2010-7-13 02:29 编辑 ]
2010-07-13 01:54
快速回复:请帮忙加入分页代码
数据加载中...
 
   



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

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