| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 312 人关注过本帖
标题:我刚入门做了个分页为什么去点页码时结果是空的呢?谢谢!先各位朋友指点。
只看楼主 加入收藏
qjw9004
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2011-1-27
结帖率:47.37%
收藏
已结贴  问题点数:2 回复次数:3 
我刚入门做了个分页为什么去点页码时结果是空的呢?谢谢!先各位朋友指点。
程序代码:
<!-- #include file="conn.asp" -->
<%
sql="select * from config"
set rs_config=conn.execute(sql)
biaoji=rs_config("biaoji")

'下面一段,打开了这个表,选择了全部的数据   
    dim rs,sql,page,username
    username=request.querystring("username")
    set rs = server.createobject("adodb.recordset")
    sql = "select * from pc_form where username='"+username+"'order by sqsj desc"
    rs.open sql,conn,1,1
    '设置每页10条
    rs.pagesize = 10
    '接收page的值
    page = request.querystring("page")
    '把接收到的值赋值给页码即可
    rs.absolutepage = page
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=biaoji%>-付款申请-</title>
<style type="text/css">
td        { font-size: 9pt; line-height: 14pt}
a:link    {color: #0080FF; text-decoration: none }
a:visited {color: #0080FF; text-decoration: none }
a:hover   {color: #ee9c00; text-decoration: underline }
</style>
</head>
<body bgproperties="fixed" background="images/bg01.gif">
<div align="center">          
  <center>                  
<table border="0" width="800" cellpadding="0" cellspacing="0" background="images/frist.jpg" style="border-collapse: collapse" bordercolor="#111111" height="120">          
  <tr>                     
    <td width="100%" align="center" valign="middle"><font size="3px" color="red"><%=biaoji%><p>-付款申请-</p></font></td>          
  </tr>          
</table>                  
  </center>
</div> 

<div>
  <center>                  
  <table border="0" width="800" bgcolor="#CACAFF" cellspacing="0" cellpadding="6" style="border:1px dotted #0000FF; border-collapse: collapse; color:#0000FF; background-color:#CACAFF" bordercolor="#111111" height="20">          
  <tr>
<%
for i = 1 to rs.pagecount
%>                    
    <td width="100%" align="right" valign="middle"><a href="pc_list.asp?page=<%=i%>"><%=i%></td>
<%
next
%>         
  </tr>          
</table>                  
  </center>
</div>
<div  id="pc" align="center">          
  <center>          
  <table border="0" width="800" bgcolor="#CACAFF" cellspacing="0" cellpadding="6" style="border:1px dotted #0000FF; border-collapse: collapse; color:#0000FF; background-color:#CACAFF" bordercolor="#111111">          
    <tr>          
      <td width="100%">


<%

for i=1 to rs.pagesize
if rs.eof then exit for   '最后一页不足10条,所以,循环到没有数据,就中途退出
%>
   <table border="0" width="100%" cellpadding="0" style="border-collapse: collapse; border: 1px dotted #A4A4FF" bordercolor="#111111" cellspacing="0">
     <!--DWLayoutTable-->          
      <tr>
        <td width="61" rowspan="13" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="49" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="137" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td colspan="3" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="81" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="68" rowspan="13" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
      </tr>
      <tr>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td colspan="2" align="center"><%=biaoji%>&nbsp;</td>
        <td colspan="3" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
      <tr>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td colspan="2" rowspan="2" align="center">现金支出(费用报销)单</td>
        <td colspan="3" align="right">&nbsp; 门:</td>
        <td align="left"><%=rs("bm")%></td>
        </tr>
      <tr>
        <td height="18" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td colspan="3" align="right" valign="top">报帐人:</td>
        <td align="left"><%=rs("username")%></td>
        </tr>
      <tr>              
        <td height="18" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="15" align="right"><font color="#225ccc"></td>
        <td align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="279" align="right"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td colspan="3" align="right"><font color="#225ccc">送达日:</td>
        <td align="left"><%=rs("sqsj")%></td>
        </tr>
      <tr>              
        <td height="10" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td height="10" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td height="10" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td height="10" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="66" height="16" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="14" height="16" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td height="10" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td height="10" align="right" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
      </tr>
      <tr>              
        <td rowspan="4" align="center" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">事由<font color="#225ccc"></td>
        <td width="15" height="20" align="center" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">1</td>  
        <td colspan="4" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=rs("sy01")%></td>
        <td width="14" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">¥:</td>
        <td align="right" valign="top" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=FormatNumber(rs("je01"))%></td>
      </tr>
      <tr>              
        <td width="15" align="center" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">2</td>
        <td colspan="4" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=rs("sy02")%></td>
        <td align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">¥:</td>
        <td align="right" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=FormatNumber(rs("je02"))%></td>
      </tr>
      <tr>              
        <td width="15" align="center" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">3</td>
        <td colspan="4" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=rs("sy03")%></td>
        <td align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">¥:</td>
        <td align="right" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=FormatNumber(rs("je03"))%></td>
      </tr>
      <tr>              
        <td width="15" align="center" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">4</td>
        <td colspan="4" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=rs("sy04")%></td>
        <td align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">¥:</td>
        <td align="right" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF"><%=FormatNumber(rs("je04"))%></td>
      </tr>
      <tr>
        <td colspan="8" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">合计金额(大写)¥:&nbsp;</td>
        </tr>
      <tr>              
        <td colspan="2" align="center" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">备注:</td>
        <td colspan="6" align="left" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF">
        <h1>
          </h1></td>
        </tr>
      <tr>              
        <td height="16" colspan="8" align="left" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>              
    </table>
<%
rs.movenext
next
%>

   
   
    </td>              
    </tr>              
  </table>              
  </center>              
</div>              
<div align="center">              
  <center>                             
  <table border="0" width="800" cellpadding="0" bgcolor="#CACAFF" style="border:1px dotted #808000; border-collapse: collapse; background-color:#CACAFF" bordercolor="#111111" cellspacing="0">                                        
    <tr>                                        
      <td width="100%" bgcolor="#ebebeb" height="2"></td>                                        
    </tr>                                        
    <tr>                                        
      <td width="100%">&nbsp;                                           
      </td>                                        
    </tr>                                        
    <tr>                                        
      <td width="100%">                                        
        <p align="center"><font color="#0066FF">--<%=biaoji%>--</font></td>                                     
    </tr>                                     
  </table>                                     
                
  </center>            
</div>
</body>                
</html>
由上一页面地址栏传递过来的信息是http://localhost/my_system/pc_list.asp?username=123
搜索更多相关主题的帖子: color 朋友 
2011-07-14 12:23
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:1 
page没有传过来

----我怎能在别人的苦难面前转过脸去----
2011-07-14 12:39
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:1 
<td width="100%" align="right" valign="middle"><a href="pc_list.asp?page=<%=i%>"><%=i%></td>
这个地方没有传参数
<td width="100%" align="right" valign="middle"><a href="pc_list.asp?username=<%=request.querystring("username")
%>&page=<%=i%>"><%=i%></td>

2011-07-14 12:42
qjw9004
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2011-1-27
收藏
得分:0 

感谢两位朋友的指点!
能否改进代码设置成上页下页及共多少条记录的吗?

2011-07-14 13:27
快速回复:我刚入门做了个分页为什么去点页码时结果是空的呢?谢谢!先各位朋友指 ...
数据加载中...
 
   



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

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