| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 519 人关注过本帖
标题:asp 分页显示数据问题
只看楼主 加入收藏
dhm123
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-8-2
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
asp 分页显示数据问题
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Check_Sql123.asp" -->

<!--#include file="admin_qx.asp" -->
<%  call islogin() %>
<!--#include file="jm5.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="conn_db123.asp" -->
<%
admin_id_log=session("admin_id_log")
admin_shenfen=session("admin_shenfen")
if  admin_id_log=""  then
response.Write "<script language=javascript>{window.alert('您尚未登录或登录超时,请重新登录!');window.open('login.asp','_parent'); }</script>"
response.end
end if
if  admin_shenfen<>"0"  then
response.Write "<script language=javascript>{window.alert('您没有权限,请重新登录!');window.open('login.asp','_parent'); }</script>"
response.end
end if

%>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.myform.chkAll.checked){
    document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    }     
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll"&&e.disabled==false)
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
    if(document.myform.Naction.value=="biDel")
    {
        document.myform.action="man_munber.asp?action=biDel";
        if(confirm("此操作不能恢恢复,确定要删除选中的记录吗?"))
            return true;
        else
            return false;
    }
    else
    {
        document.myform.action="Admin_ArticleMove.asp";
        if(document.myform.TargetClassID.value=="")
        {
            alert("不能将文章移动到含有子栏目的栏目或外部栏目中!");
            return false;
        }
        if(confirm("确定要将选中的文章移动到指定的栏目吗?"))
            return true;
        else
            return false;
    }
}

</SCRIPT>
<%
session("url")="s_ck0.asp?pageno="&pageno
sub del()
action=request("action")
id=saferequest("id")
if action="biDel" then
dim k,rsdel
set rsdel=server.createobject("adodb.recordset")
    for each k in request.form("id")
    sqldel="select * from student where sno="&k
    rsdel.open sqldel,conn,1,3                  
    rsdel.delete
    rsdel.update
    rsdel.close
    next
elseif action="del" then
set rs=server.createobject("adodb.recordset")
sql="select * from student where sno="&id
rs.open sql,conn,1,3
rs.delete
rs.update
rs.close
end if
response.redirect session("url")
end sub
%>
<%
if request("action")="del" then
call del()
elseif request("action")="biDel" then
call del()
else
call managemunber()
end if
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<title>学生信息管理</title>
<style type="text/css">
<!--
.STYLE5 {color: #000000}
.STYLE15 {font-size: 14; color: #FF0000; }
.STYLE7 {font-size: 12px; color: #0000FF; }
.STYLE17 {color: #006600}
.STYLE4 {font-size: 12px; color: #FF0000; }
.style1 {color: #0000FF}
body {
    SCROLLBAR-FACE-COLOR: #c6ebde;
    SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
    SCROLLBAR-SHADOW-COLOR: #39867b;
    SCROLLBAR-3DLIGHT-COLOR: #39867b;
    SCROLLBAR-ARROW-COLOR: #330000;
    SCROLLBAR-TRACK-COLOR: #e2f3f1;
    SCROLLBAR-DARKSHADOW-COLOR: #ffffff;
    background-image: url();
    background-color: #d6dff7;
}
body,td,th {
    font-size: 13px;
}
.STYLE13 {color: #0000FF; font-size: 14px; }
.STYLE2 {color: #FF0000}
.style3 {color: #FF0000}
-->
</style>
</head>

<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<%sub managemunber()
%>
<table class=tableBorder width="95%" border=0 align="center" cellpadding=5 cellspacing=1>
    <tbody>
      <tr>
        <th width="100%" height=21 sytle="line-height:150%"><span class="STYLE7">【学生信息管理】</span></th>
      </tr>
      <tr>
        <td  class=forumRow>
    <div align="center"><form name="myform" method="Post" action="" onSubmit="return ConfirmDel();">
     <table width="99%" border="1" align="center" cellpadding="3" cellspacing="1" bordercolor="#F3F3F3" style="border-collapse: collapse">
     
      <tr>
      <td width="3%" height="30" align="center" class="STYLE7">选中</td>
        <td width="10%" height="30" align="center" class="STYLE7">姓名</td>
        <td width="5%" class="STYLE5" align="center">性别</td>
        <td width="20%" class="STYLE7" align="center">身份证号</td>
        <td width="25%" class="STYLE5" align="center">班级</td>
        <td width="16%" class="STYLE7" align="center">宿舍</td>
        <td width="7%" class="STYLE5" align="center">籍贯</td>
        <td width="17%" align="center" class="STYLE7">操&nbsp;作</td>
      </tr>
      <%
sql="select * from student order by zctime desc"
url="s_ck0.asp?pageno="
rs.CursorLocation=3
rs.open sql,conn,1,1
if rs.eof then

%>

 <tr>
        <td height="60" colspan="7" align="left" class="STYLE7">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;暂无学生信息!</td>
        </tr>

<%
else

                   totalcount=rs.recordcount
                   pagesize=20
                   rs.pagesize=pagesize
                   pagecount=rs.pagecount
                   PageNo=saferequest("PageNo")
                   intpageno pageno,pagecount
                   rs.AbsolutePage=pageno
for j=1 to rs.PageSize

bid=rs("bid")
sgno=rs("sgno")

sql="SELECT b_name FROM  class where bid='" &rs("bid")& "'"
rs2.open sql,cn,1,2
 response.Write(sql)
 if not rs2.eof then

   b_name=rs2("b_name")
  else
   b_name="暂未分班!"
end if
rs2.close
set rs2=nothing

sql="SELECT sgname,sglb FROM  sg where sgno='" &rs("sgno")& "'"
ask.open sql,cn,1,2
if not ask.eof then
   sgname=ask("sgname")
   sglb=ask("sglb")
else
 sgname="暂未分宿舍!"
 sglb=""
end if
ask.close
set ask=nothing
      %>
       <tr>
       <td width="3%" height="30" align="center" class="STYLE7"><input name='id' type='checkbox' onClick="unselectall()" id="id" value='<%=rs("sno")%>'></td>
        <td width="10%" height="30" align="center" class="STYLE7"><%=rs("s_name")%></td>
        <td width="5%" class="STYLE5" align="center"><%if rs("s_xb")=1 then%>女<%else%>男<%end if%></td>
        <td width="20%" class="STYLE7" align="center"><%=rs("sfzno")%></td>
        <td width="25%" class="STYLE5" align="center"><%=b_name%></td>
        <td width="16%" class="STYLE7" align="center"><%=sglb%>&nbsp;<%=sgname%><%response.Write(rs("sgno"))%></td>
        <td width="7%" class="STYLE5" align="center"><%=rs("sf")%></td>
        <td width="17%" align="center" class="STYLE7"><a href="s_ck.asp?id=<%=rs("sno")%>" class="STYLE7">查&nbsp;看</a>/<a href="s_xg.asp?id=<%=rs("sno")%>" class="STYLE7">修&nbsp;改</a>/<a href="javascript:if (confirm('确定要删除此条信息吗?')){location='s_ck0.asp?action=del&id=<%=rs("sno")%>';}" class="STYLE7">删&nbsp;除</a></td>
      </tr>
        <%
rs.movenext
if rs.eof then exit for
next
%><tr>
<td height="60" colspan="8" align="left" class="STYLE7">  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              全选
              <input name="submit" type='submit' value='删除' onClick="document.myform.Naction.value='biDel'"> </td></tr>
                      <tr >
                        <td height="60" colspan="8" align="right" ><span class="STYLE7">
                          <%
          if totalcount>pagesize then Showpage pagecount,totalcount,PageNo,url,pagesize,1
          %>
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   </span></td>
                      </tr>
                      <%
end if
rs.close
set rs=nothing

%>
    </table></form>
    </div>

</td>
      </tr>
    </tbody>
</table>
<%end sub
%>
</body>
</html>

代码如上,现象是:PageSize=1 这么分页显示数据就正确,如PageSize>1则分页显示时宿舍和班级的数据显示不正确

请高手指教下
搜索更多相关主题的帖子: javascript 数据 include parent file 
2012-08-02 11:34
dhm123
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-8-2
收藏
得分:0 
回复 楼主 dhm123
坐等
2012-08-02 11:34
yjlwwl
Rank: 2
等 级:论坛游民
帖 子:5
专家分:33
注 册:2012-8-2
收藏
得分:20 
代码太乱,看不清,给一个分页代码参考一下:

<%‘打开数据库代码自己加上

          TSum=1   ’分面开始
           mypage=16
        srs.pagesize=CINT(mypage)
     PageNo=CLng(REQUEST("PageNo"))
          if PageNo="" or PageNo=0 then
       PageNo=1
     end if
        if not srs.eof then
        TSum=INT(srs.RECORDCOUNT/Mypage*-1)*-1
       srs.absolutepage=PageNo
      RowCount=srs.PageSize     
      nowrecord=0
      end if
if rs.eof then
%>
此处是数据库为空时,显示信息!!!
<%
else
for i=1 to mypage
if rs.eof then exit for
%>
 在此插入显示数据
<%
      end if
    rs.movenext
    next
     end if
%>
<% '显示分页连接
if (PageNo*mypage-mypage)>0 then
    PrwePage=PageNo-1   
       response.write "<b><a href='kq_luru.asp?ifdone="&ifdone&"&title="&temp&"&PageNo="&PrwePage&"&type="&queryflag&"'& class='aapply'>上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
       else
       response.write "<b>上一页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
       end if
       if (PageNO*mypage)<srs.recordcount then
       NextPage=PageNo+1   
       response.write"&nbsp;<a href='kq_luru.asp?ifdone="&ifdone&"&title="&temp&"&PageNo="&NextPage&"&type="&queryflag&"'& class='aapply'>下一页</a></b>"  
       else
         response.write"&nbsp;下一页</b>"
         end if
%>
2012-08-02 23:10
快速回复:asp 分页显示数据问题
数据加载中...
 
   



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

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