| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 531 人关注过本帖
标题:分页出问题
只看楼主 加入收藏
DCQZ
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2010-7-23
结帖率:80%
收藏
已结贴  问题点数:20 回复次数:2 
分页出问题
麻烦帮我看一下这分页代码出什么问题,我想每页10条信息的,结果全部都读出来了


<!--#include file="../InClude/Conn.asp"-->
<!--#include file="publiclist.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="expires" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../images/main/greencss.css">
<script language="javascript1.2" src="/images/js/openwin.js"></script>
<title>复大集团网络办公系统</title>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="/images/tab/images/tab_03.gif" width="15" height="30" /></td>
        <td width="1101" background="/images/tab/images/tab_05.gif"><img src="/images/tab/images/311.gif" width="16" height="16" /> <span class="STYLE4">收件箱</span></td>
        <td width="981" background="/images/tab/images/tab_05.gif">
        <!--停-->
        </td>
        <td width="14"><img src="/images/tab/images/tab_07.gif" width="14" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9" background="/images/tab/images/tab_12.gif">&nbsp;</td>
        <td bgcolor="#f3ffe3" height="450" valign="top">
        <!--中间-->

<form method="post" name="form1" action="getemailbox.asp">
<%
if request("delbutton1")="放进废件箱" then
    call delemail(0)
end if
if request("delbutton2")="永久删除" then
    call delemail(1)
end if




dim idCount'记录总数
  dim pages'每页条数
      pages=10
  dim pagec'总页数
  dim page'页码
      page=Cint(request.QueryString("page"))
  dim pagenc'每页显示的分页页码数量=pagenc*5+1
      pagenc=5
  dim pagenmax'每页显示的分页的最大页码
  dim pagenmin'每页显示的分页的最小页码
  dim pageprevious'上一相邻的页码
  dim j   '分页判断显示变量
      j=1
  dim n
      n=1
   
sql="select count(getuserid) as idCount from getemailtable"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,0,1
  idCount=rs("idCount")
  if(idcount>0) then'如果记录总数=0,则不处理
    if(idcount mod pages=0)Then
      pagec=int(idcount/pages)
       else
      pagec=int(idcount/pages)+1
    end if
    sql="select getuserid from getemailtable order by getuserid desc  "
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,1
    rs.pagesize = pages
  dim pagenext
  if page < 1 then
     page = 1
  end if
  if page > pagec then
     page = pagec
  end if
  if pagec > 0 then
    rs.absolutepage = page
     for i=1 to rs.pagesize
      if rs.eof then exit for  
      if(i=1)then
        sqlid=rs("getuserid")
      else
        sqlid=sqlid &","&rs("getuserid")
      end if
      rs.movenext
    next
  end if
     sql="select * from userinf,getemailtable where getuserid in("& sqlid &") and getuserid="&cstr(74)&" and getemailtable.deleteflag=0 and userinf.id=getemailtable.senduserid order by emaildate desc"
    'sql="select * from getemailtable where getuserid in("& sqlid &") "  
    'call listemail(sql,"您的收件箱中没有邮件!","newandread")
function listemail(sql,errorstr,recordtype)
 set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,0,1
    if rs.eof or rs.bof then
        conn.close
        set rs=nothing
        response.write "<p align=""center""><font color=""#dd0000"">"&errorstr&"</font></p>"
    else
%>
<script language="javascript">
function lookemail(recordid)
{
    win=window.open('lookemail.asp?id='+recordid,'win'+recordid,'toolbar=no,scrollbars=yes,resizable=0,menubar=no,width=550,height=500');   
}
</script>
<div align="center">
  <center>
<table border="0" cellpadding="5" cellspacing="0" width="95%" class="tablebreak">
  <tr>
    <td width="100%"><font color="#000000">&nbsp; 共<font color="red"><%=idCount%></font>条邮件   
(<img src="../images/newmail.gif" border="0">:新邮件&nbsp;&nbsp;&nbsp;<img src="../images/readmail.gif" border="0">:已读邮件&nbsp;&nbsp;&nbsp;<img src="../images/delmail.gif" border="0">:已删除邮件)已读邮件&nbsp;&nbsp;&nbsp;<img src="../images/atchm.gif" border="0">:附件)</font>
</td>
  </tr>
</table>
  </center>
</div>
<div align="center">
  <center>
  <table border="1" width="95%" cellspacing="0" cellpadding="0" bordercolorlight="#c0de98" bordercolordark="#c0de98" class="tablebreak">
    <tr>
      <td background="/images/portlet/panel-titlehead-bg.gif" align="center" width="36" height="25"><font color="#000000">选择</font></td>
      <td background="/images/portlet/panel-titlehead-bg.gif" align="center" width="40" height="25"><font color="#000000">状态</font></td>
      <td background="/images/portlet/panel-titlehead-bg.gif" align="center" width="27" height="25"><font color="#000000">附件</font></td>
      <td background="/images/portlet/panel-titlehead-bg.gif" align="center" width="172" height="25"><font color="#000000">发件人</font></td>
      <td background="/images/portlet/panel-titlehead-bg.gif" align="center" width="375" height="25"><font color="#000000">主题</font></td>
      <td background="/images/portlet/panel-titlehead-bg.gif" align="center" width="165" height="25"><font color="#000000">日期</font></td>
    </tr>
<%

   Do While Not rs.eof
%>
    <tr bgcolor="#ffffff">
      <td width="36" align="center" style="height:23px;line-height:23px;">
        <font color="#000000">
            <input type="checkbox" name="selectnumber" value="<%=cstr(rs("autoid"))%>">
        </font>
      </td>
      <td width="40" align="center">
<font color="#000000">
<%
    select case recordtype   
        case "new"
            imgstr="../images/newmail.gif"
            explainstr="新邮件"
        case "newandread"
            if rs("readflag") then
                imgstr="../images/readmail.gif"
                explainstr="已读邮件"
            else
                imgstr="../images/newmail.gif"
                explainstr="新邮件"
            end if
        case "delete"
            imgstr="../images/delmail.gif"
            explainstr="已删除邮件"
    end select
%>
        <img src="<%=imgstr%>" align="absmiddle" border="0" title="<%=explainstr%>">
</font>
      </td>
       <td width="27" align="center"><%If rs("eupfiles") <> "" Then %><img src="/images/atchm.gif" width="14" height="14" alt="有附件下载"><%End if%></td>
      <td width="172" align="center"><font color="#000000"><%=server.htmlencode(rs("name"))%></font></td>
      <td width="375" align="center"><a href="#" onClick="javscript:lookemail('<%=cstr(rs("autoid"))%>')"><font color="#000000"><%=server.htmlencode(rs("emailtitle"))%></font></a></td>
      <td width="165" align="center"><font color="#000000"><%=cstr(rs("emaildate"))%></font></td>
    </tr>
<%
 
    rs.movenext
    Loop
%>
  </table>
  </center>
</div>
<%
    End if

    end function %>
   
    <%=listemail(sql,"您的收件箱中没有邮件!","newandread") %>
<%

response.write "<div style=""margin-left:200px; margin-top:20px;float:left; text-align:center; "">"

  Response.Write "共"&idCount&"条记录/共"&pagec&"页&nbsp;&nbsp;<a href='getemailbox.asp?page=1'>首页</a>"

if (page>1) then
           Response.Write "&nbsp;&nbsp;<a href='getemailbox.asp?page="&page-1&"'><<</a>"
         
end if

if(pagec<=5) then
            while(j<=pagec)
            Response.Write "&nbsp;<a href='getemailbox.asp?page="&j&"'>"&j&"</a>"
            j=j+1
            Wend
        else
            while(j<=5)
            Response.Write "&nbsp;<a href='getemailbox.asp?page="&j&"'>"&j&"</a>"
            j=j+1
            Wend
end if   
   
if (page<pagec) then
            Response.Write "&nbsp;<a href='getemailbox.asp?page="&page+1&"'>>></a>"
end if
            Response.Write "&nbsp; &nbsp;<a href='getemailbox.asp?page="&pagec&"'>尾页</a>"
            end if
            Response.Write "</div>"
%>

<div align="right" style="padding-right:50px;padding-top:20px;">
<input type="submit" name="delbutton1" value="放进废件箱">&nbsp;&nbsp;
<input type="submit" name="delbutton2" value="永久删除">
</div>
</form>
        <!--中间-->
        </td>
        <td width="9" background="/images/tab/images/tab_16.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="/images/tab/images/tab_20.gif" width="15" height="29" /></td>
        <td background="/images/tab/images/tab_21.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="25%" height="29" nowrap="nowrap"><!--下框-->&nbsp;<!--下框--></td>
          </tr>
        </table></td>
        <td width="14"><img src="/images/tab/images/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
<!--版本-->
<div align="center">
  <center>
  <table>
    <tr>
      <td height=19>
        <table border="0" cellpadding="0" cellspacing="0" width="610" height="19">
          <tr>
          <td width="100%" height=20><p align="center"><font color="#808080">FuDa E-Office System V1.0 &copy; <a href="http://www. target="_blank">  
          </tr>
        </table>
      </td>
    </tr>

  </table>
  </center>
</div>
<!--版本-->
</body>
</html>
2010-08-25 15:25
liangfengfen
Rank: 2
等 级:论坛游民
帖 子:50
专家分:10
注 册:2010-8-22
收藏
得分:10 
我还不懂分页唉
2010-08-25 15:44
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:10 
for i=1 to rs.pagesize
pagesize 未定义!

QQ:63572063
2010-08-26 20:57
快速回复:分页出问题
数据加载中...
 
   



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

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