标题:asp中手看看这个asp文件,错误在哪里?
只看楼主
xionglijie
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-11-14
结帖率:0
已结贴  问题点数:20 回复次数:1 
asp中手看看这个asp文件,错误在哪里?

这是一个网吧会员消费查询系统的文件,“查询消费记录”是正常是,

但是“查询加钱记录”不正常,问题出在翻页,比如查询加钱记录有4页,你点下一页,就跳转到消费记录上面去了!

各位大哥帮小弟看看!小弟只是家网吧的小网管!










<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link href="all.css" rel="stylesheet" type="text/css" />
<title>会员详细资料</title>
</head>

   <%
       const MaxPerPage=15
       dim totalPut   
       dim CurrentPage
       dim TotalPages
       dim i,j
       dim idlist
       dim title

       if not isempty(request("page")) then
              currentPage=cint(request("page"))
       else
              currentPage=1
       end if
       dim sql
       dim rs
%>
<body topmargin="0" leftmargin="0">
               
<div align="center">
  <center>
  <table width="72%" height="135" bgcolor="#E8E8E8" cellspacing cellpadding>
    <tr>
      <td width="100%" height="18">
        <table width="100%" cellspacing cellpadding>
          <tr>
          <%
set rs=server.createobject("adodb.recordset")
sql="SELECT * from tUsers where sCardID='"&Request.Cookies("sname")&"'"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "<script>alert('没有!!');location.href='javascript:history.back(1)';</Script>"
response.end
end if
%>
            <td width="100%" bgcolor="#757575" height="22">
              <p align="center"><font color="#FFFFFF">会员详细资料&nbsp;&nbsp;            
              <a href="logout.asp"></a></font><a href="info.asp?out=ok"><font color="#FF0000">退出系统</font></a></td>      
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td width="100%" height="2"> </td>
    </tr>
    <tr>
      <td width="100%" height="122">
        <table width="100%" height="128" cellpadding="2" bordercolordark="#FFFFFF">
          <tr>
            <td width="14%" height="25" align="center" bgcolor="#757575"><font color="#FFFFFF">会员卡号</font></td>
            <td width="32%" height="25" bgcolor="#FFFFFF"><%=rs("sCardID")%></td>
            <td width="13%" height="25" align="center" bgcolor="#757575"><font color="#FFFFFF">会员姓名</font></td>
            <td width="41%" height="25" bgcolor="#FFFFFF"><%=rs("sName")%></td>
          </tr>
          <tr>
            <td width="14%" height="25" align="center" bgcolor="#757575"><font color="#FFFFFF">卡号类型</font></td>
            <td width="32%" height="25" bgcolor="#FFFFFF"><%=rs("sDis")%></td>
            <td width="13%" height="25" align="center" bgcolor="#757575"><font color="#FFFFFF">剩余金额</font></td>
            <td width="41%" height="25" bgcolor="#FFFFFF"><%=rs("mRemain")%></td>
          </tr>
          <tr>
            <td width="14%" height="26" align="center" bgcolor="#757575"><font color="#FFFFFF">会员密码</font></td>
            <td width="32%" height="26" bgcolor="#FFFFFF"><input type="password" name="T1" size="16" value="<%=rs("sPassword")%>"></td>
            <td width="13%" height="26" align="center" bgcolor="#757575"><font color="#FFFFFF">会员积分</font></td>
            <td width="41%" height="26" bgcolor="#FFFFFF"><%=rs("iHeap")%></td>
          </tr>
          <tr>
            <td width="14%" height="26" align="center" bgcolor="#757575"><font color="#FFFFFF">会员状态</font></td>
            <td width="32%" height="26" bgcolor="#FFFFFF"><%=rs("sState")%></td>
            <td width="13%" height="26" align="center" bgcolor="#757575"><font color="#FFFFFF">最后下机</font></td>
            <td width="41%" height="26" bgcolor="#FFFFFF"><%=rs("dtLast")%></td>
          </tr>
          <tr>
            <td width="14%" height="11" align="center" bgcolor="#757575"><font color="#FFFFFF">证件类型</font></td>
            <td width="32%" height="11" bgcolor="#FFFFFF"><%=rs("sCardType")%></td>
            <td width="13%" height="11" align="center" bgcolor="#757575"><font color="#FFFFFF">证件号码</font></td>
            <td width="41%" height="11" bgcolor="#FFFFFF"><%=rs("sIDCard")%></td>
          </tr>
          <tr>
            <td width="14%" height="3" align="center" bgcolor="#757575"><font color="#FFFFFF">开通时间</font></td>
            <td width="32%" height="3" bgcolor="#FFFFFF"><%=rs("dtAccount")%></td>
            <td width="13%" height="3" align="center" bgcolor="#757575"><font color="#FFFFFF">到期时间</font></td>
            <td width="41%" height="3" bgcolor="#FFFFFF"><%=rs("dValidity")%></td>
          </tr>
        </table>
        <%
set rs=Nothing
%>
      </td>
    </tr>
    <tr>
<%
set rs=server.createobject("adodb.recordset")
if request.querystring("money")="add" then
sql="SELECT * from tAdd where sCardID='"&Request.Cookies("sname")&"' order by cremain desc"
else
sql="SELECT * from tLogs where sCardID='"&Request.Cookies("sname")&"' order by dtTime1 desc"


end if



If IsSql = 1 Then
rs.open sql,qqconn,1,1
else
rs.open sql,conn,1,1
end if
if rs.eof and rs.bof then
 response.write "&nbsp;<br>抱歉,数据库里没有!"
 else
        totalPut=rs.recordcount
        if currentpage<1 then
        currentpage=1
        end if

        if (currentpage-1)*MaxPerPage>totalput then
             if (totalPut mod MaxPerPage)=0 then
                 currentpage= totalPut \ MaxPerPage
             else
                 currentpage= totalPut \ MaxPerPage + 1
             end if
        end if
        if currentPage=1 then
        showContent
        showpage totalput,MaxPerPage,"info.asp"
        else
        if (currentPage-1)*MaxPerPage<totalPut then
            rs.move (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
            showContent
            showpage totalput,MaxPerPage,"info.asp"
        else
             currentPage=1
            showContent
            showpage totalput,MaxPerPage,"info.asp"
             end if
         end if
    rs.close
    end if
   
    sub showContent
    dim i
         i=0
%>
      <td width="100%" height="1" valign="top">
        <table width="100%" height="1" cellpadding="2">
          <tr>
            <td width="50%" height="26" align="center" bgcolor="#757575"><a href="info.asp"><font color="#FFFF00"><u>您的上机记录</u></font></a></td>
            <td width="50%" height="26" align="center" bgcolor="#757575"><a href="info.asp?money=add"><font color="#FFFF00"><u>您的加钱记录</u></font></a></td>
          </tr>
          <tr>
            <td width="101%" height="4" colspan="2" valign="top">
              <table width="100%" cellspacing="1" height="1">
                <tr><%if request.querystring("money")="add" then%>
                                    <td width="13%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">卡号</font></td>
                  <td width="20%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">加钱时间</font></td>
                  <td width="19%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">类型</font></td>
                  <td width="13%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">会员类型</font></td>
                  <td width="18%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">加入金额</font></td>
                </tr>
                <tr><%do while not rs.eof%>
                  <td width="13%" bgcolor="#FFFFFF" height="20"><%=rs("sCardID")%></td>
                  <td width="20%" bgcolor="#FFFFFF" height="20"><%=rs("dtTime")%></td>
                  <td width="19%" bgcolor="#FFFFFF" height="20">
                    <p align="center"><%=rs("sType")%></td>
                  <td width="13%" bgcolor="#FFFFFF" height="20">
                    <p align="center"><%=rs("sDis")%></td>
                  <td width="18%" bgcolor="#FFFFFF" height="20"><%=rs("cRemain")%></td>
                </tr>
                                 <%
          i=i+1
          if i>=MaxPerPage then exit do
          rs.movenext
        loop
    %><%else%>
               <tr>
<td width="13%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">卡号</font></td>
                  <td width="20%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">上机时间</font></td>
                  <td width="19%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">下机时间</font></td>
                  <td width="13%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">机器名</font></td>
                  <td width="18%" bgcolor="#757575" align="center" height="22"><font color="#FFFFFF">本次消费金额</font></td>
                  
                </tr>
                <tr>

                  <%do while not rs.eof%>
                  <td width="13%" bgcolor="#FFFFFF" height="20"><%=rs("sCardID")%></td>
                  <td width="20%" bgcolor="#FFFFFF" height="20"><%=rs("dtTime1")%></td>
                  <td width="19%" bgcolor="#FFFFFF" height="20"><%=rs("dtTime2")%></td>
                  <td width="13%" bgcolor="#FFFFFF" height="20">
                    <p align="center"><%=rs("sCom")%></td>
                  <td width="18%" bgcolor="#FFFFFF" height="20"><%=rs("cReceived")%>元</td>
                  
                </tr>
                <%
          i=i+1
          if i>=MaxPerPage then exit do
          rs.movenext
        loop
    %><%end if%>
                <tr>

                  <td width="83%" bgcolor="#FFFFFF" colspan="5" height="1">
                    <%
   end sub

    function showpage(totalnumber,maxperpage,filename)
      dim n

      if totalnumber mod maxperpage=0 then
             n= totalnumber \ maxperpage
      else
             n= totalnumber \ maxperpage+1
      end if
      response.write "<table cellspacing=1 width='100%' border=0 colspan='4' ><form method=Post action="""&filename&"""><tr><td align=center> "
      if CurrentPage<2 then
            response.write "共有<strong><font color=red>"&totalnumber&"</font></strong>条&nbsp;<font face=Webdings>9</font> <font face=Webdings>7</font>&nbsp;"
      else
            response.write "共有<strong><font color=red>"&totalnumber&"</font></strong>条&nbsp;<a href="&filename&"?page=1><font face=Webdings>9</font></a>&nbsp;"
            response.write "<a href="&filename&"?page="&CurrentPage-1&"><font face=Webdings>7</font></a>&nbsp;"
      end if

      if n-currentpage<1 then
            response.write "<font face=Webdings>8</font> <font face=Webdings>:</font>"
      else
            response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
            response.write "<font face=Webdings>8</font></a> <a href="&filename&"?page="&n&"><font face=Webdings>:</font></a>"
      end if
              response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
           response.write "&nbsp;<b>"&maxperpage&"</b>条/页 "
end function
%>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </center>
</div>

</body>

</html>
<%
if request.querystring("out")="ok" then
Response.Cookies("user_name")=""
response.redirect"login.asp"
response.end
end if
%>
搜索更多相关主题的帖子: 文件 asp 
2009-11-14 23:11
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
得分:20 
程序代码:
action = request.querystring("money")
'调用分页的地方
showpage totalput,MaxPerPage,"info.asp?money="&action
'分页函数
    function showpage(totalnumber,maxperpage,filename)
      dim n

      if totalnumber mod maxperpage=0 then
             n= totalnumber \ maxperpage
      else
             n= totalnumber \ maxperpage+1
      end if
      response.write "<table cellspacing=1 width='100%' border=0 colspan='4' ><form method=Post action="""&filename&"""><tr><td align=center> "
      if CurrentPage<2 then
            response.write "共有<strong><font color=red>"&totalnumber&"</font></strong>条&nbsp;<font face=Webdings>9</font> <font face=Webdings>7</font>&nbsp;"
      else
            response.write "共有<strong><font color=red>"&totalnumber&"</font></strong>条&nbsp;<a href="&filename&"&page=1><font face=Webdings>9</font></a>&nbsp;"
            response.write "<a href="&filename&"&page="&CurrentPage-1&"><font face=Webdings>7</font></a>&nbsp;"
      end if

      if n-currentpage<1 then
            response.write "<font face=Webdings>8</font> <font face=Webdings>:</font>"
      else
            response.write "<a href="&filename&"&page="&(CurrentPage+1)&">"
            response.write "<font face=Webdings>8</font></a> <a href="&filename&"&page="&n&"><font face=Webdings>:</font></a>"
      end if
              response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
           response.write "&nbsp;<b>"&maxperpage&"</b>条/页 "
end function
'就是把所有用到的参数都在分页链接里面一起传递

2009-11-15 08:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-292321-1-1.html




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

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