加条件后分页显示不对,请帮我修改一下,谢谢!
加条见后分页数据显示不对,请帮我看看谢谢!<!--#include file="../conn.asp"-->
<script language="JavaScript" type="text/javascript">
function StudentName(){
document.form1.StudentName.focus();
document.form1.StudentName.select();
}
function checkStudentName(){
if (document.form1.StudentName.value==""){
alert('请输入姓名!');
document.form1.StudentName.focus();
document.form1.StudentName.select();
return false;
}
}
function checkClassName(){
if (document.form2.ClassName.value==""){
alert('请输班级名称!');
document.form2.ClassName.focus();
document.form2.ClassName.select();
return false;
}
}
</script>
<body onLoad="javascript:StudentName();">
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#cccccc" bgcolor="#999999">
<tr>
<td height="25" align="center" bgcolor="#e4e4e4"><b>学生费用查询</b></td>
</tr>
<form id="form1" name="form1" method="post" action="?action=zhao_bh">
<tr>
<td height="25" align="center" bgcolor="#FFFFFF">姓名: <input name="StudentName" type="text" id="StudentName" size="30"/> <input type="submit" name="Submit" value="查找..." onClick="javascript:return checkStudentName();" />(不支持模糊查询)</td>
</tr>
</form>
<form id="form2" name="form2" method="post" action="?action=zhao_mc">
<tr>
<td height="25" align="center" bgcolor="#FFFFFF">班级: <input name="ClassName" type="text" id="ClassName" size="30"/> <input type="submit" name="Submit" value="查找..." onClick="javascript:return checkClassName();" />(不支持模糊查询)</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#cccccc" bgcolor="#999999">
<tr height="25" bgcolor="#CCCCCC" align="center">
<td width="7%"><b>学号</b></td>
<td width="7%"><b>姓名</b></td>
<td width="20%"><b>班级</b></td>
<td width="13%"><b>缴费金额</b></td>
<td width="13%">班级明细</td>
<td width="13%">学生明细</td>
</tr>
<%
action=trim(request.querystring("action"))
select case action
case "zhao_bh"
StudentName=request.form("StudentName")
Set rs= Server.CreateObject("ADODB.RecordSet")
sql= "select * from FeeQuery_list where StudentName like '%"&StudentName&"%'"
rs.open sql,conn,1,1
case "zhao_mc"
ClassName=request.form("ClassName")
Set rs= Server.CreateObject("ADODB.RecordSet")
sql= "select * from FeeQuery_list where classname like '%"&classname&"%'"
rs.open sql,conn,1,1
case ""
Set rs= Server.CreateObject("ADODB.RecordSet")
sql= "select * from FeeQuery_list "
rs.open sql,conn,1,1
end select
if not rs.eof then
const maxperpage=20 '定义每一页显示的数据记录的常量
dim currentpage '定义当前页的变量
rs.pagesize=maxperpage
currentpage=request("page")
if currentpage="" or not Isnumeric(currentpage) then
currentpage=1
elseif currentpage<1 then
c1urrentpage=1
else
currentpage=clng(currentpage)
if currentpage > rs.pagecount then
currentpage=rs.pagecount
end if
end if
'如果变量c1urrentpage的数据类型不是数值型
'就1赋给变量c1urrentpage
if not isnumeric(currentpage) then
currentpage=1
end if
dim totalput,n '定义变量
totalput=rs.recordcount
if totalput mod maxperpage=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
if n=0 then
n=1
end if
rs.move(currentpage-1)*maxperpage
i=0
do while i< maxperpage and not rs.eof
i=i+1
%>
<tr height="25" bgcolor="#FFFFFF" align="center">
<td><%=rs("sid")%></td>
<td><%=rs("StudentName")%></td>
<td><%=rs("ClassName")%></td>
<td><%=rs("FeeAount")%></td>
<td width="8%"><a href="Class_FeeQuery_List.asp?ClassName=<%=rs("ClassName")%>">明细</a></td>
<td width="8%"><a href="FeeQuery_List.asp?sid=<%=rs("sid")%>">明细</a></td>
</tr>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
<tr>
<td colspan="9" align="right">
页数 <font color="red"><%=currentpage%></font>/<% =n%>
<% k=currentpage
if k<>1 then%>
[<a class="link" href="TeacherQuery.asp?page=1">首页</a>]
[<a class="link" href="TeacherQuery.asp?page=<%=k-1%>">上一页</a>]
<%else%>
[首页] [上一页]
<%end if%>
<%if k<>n then%>
[<a class="link" href="TeacherQuery.asp?page=<%=k+1%>">下一页</a>]
[<a class="link" href="TeacherQuery.asp?page=<%=n%>">尾页</a>]
<%else%>
[下一页] [尾页]
<%end if%>
共有<font color="red"><%=totalput%></font>条记录 <font color="red"><%=maxperpage%></font>个/页
共有<font color="red"><%=n%></font>页 </td>
</tr>
</table>
</body>