asp组合查询分页问题,请教高手
我是新手,遇到分页问题,请高手帮忙看看,参数传递不过去,点下一页显示全部附源码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<!--#include file = "inc/conn.asp" -->
<!--#include file = "CheckLogin.asp" -->
<!--#include file = "inc/zhuru.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<STYLE type=text/css>TD {
FONT-SIZE: 9pt; LINE-HEIGHT: 12pt
}
A:link {
COLOR: #0000ff; TEXT-DECORATION: none
}
A:visited {
COLOR: #0000FF; TEXT-DECORATION: none
}
A:hover {
COLOR: #CC6600; TEXT-DECORATION: underline
}
</STYLE></head>
<%
Dim strSearchSql ,strKc ,strBy ,strBj ,strBy0,strxq
strBy = Request("By")
strBy0 = Request("By0")
strBj = trim(Request("classid"))
strKc = trim(Request("Kc"))
strxq = trim(Request("xq"))
bzr=Session("UserName")
strSql = "SELECT * FROM class WHERE mainteacher='"&bzr&"'"
Set rs11 = Server.CreateObject("ADODB.Recordset")
rs11.open strSql,conn,1,1
bj=rs11("name")
If strBj <> "" And strBy <> "" and strKc <> "" and strby0 <> "" Then
If strBy = "zp" and strby0 = "全部" Then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"'"
elseIf strBy = "zp" and strby0 = "及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and zongpingfen > 59"
elseIf strBy = "zp" and strby0 = "不及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and zongpingfen < 60"
elseIf strBy = "bukao1" and strby0 = "及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and bukao1 > 59"
elseIf strBy = "bukao1" and strby0 = "不及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and bukao1 < 60"
elseIf strBy = "bukao2" and strby0 = "及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and bukao2 > 59"
elseIf strBy = "bukao2" and strby0 = "不及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and bukao2 < 60"
elseIf strBy = "bukao3" and strby0 = "及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and bukao3 > 59"
elseIf strBy = "bukao3" and strby0 = "不及格" then
strSearchSql = "WHERE class = '"& strBj &"' and xueqi = '"& strxq &"' and kemu = '"& strKc &"' and bukao3 < 60"
Else
strSearchSql = "WHERE "& strBy &" = '"& strBj &"' and kemu = '"& strKc &"'"
End If
Else
strSearchSql = "WHERE class = '"& bj &"'"
End If
Dim rs,rs11,rs22 ,strSql ,Num ,pageNum ,page ,loopNum
bzr=Session("UserName")
strSql = "SELECT * FROM Student_cj " & strSearchSql
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql,conn,1,1
'If rs.EOF Then
' Response.Write("对不起,没有记录!")
' Response.End
'End If
%>
<body topmargin="5" leftmargin="5">
<%
If rs.recordcount > 0 Then
rs.pagesize = 14
Num = rs.recordcount
pageNum = rs.pagecount
page = Request.QueryString("page")
If page <> "" Then
page = Cint(page)
ElseIf page < 1 Then
page = 1
Else
page =1
End If
If page < 1 then
page =1
End If
If page*rs.pagesize >Num and Not ((page-1)*rs.pagesize <Num) Then
page = 1
End If
rs.absolutepage = page
If page <> pageNum Then
LoopNum = rs.pagesize
Else
LoopNum = Num - (page-1)*rs.pagesize
End If
%>
<table width="808" style="border-collapse: collapse" height="37">
<form id="form1" name="form1" id="form1" method="post" action="Index_Student_kq.asp" target="_self">
<td width="796" bgcolor="#6699FF" height="37" align="center" colspan="16">
选择班级:
<select name="classid" size="1">
<%
strSql = "SELECT * FROM Class WHERE name='"&bj&"'"
Set rs111 = Server.CreateObject("ADODB.Recordset")
rs111.open strSql,conn,1,1
%>
<%
Do While Not rs111.EOF
%>
<option value=<%=rs111("name")%> selected><%=rs111("name")%></option>
<%
rs111.movenext
loop
rs111.close
%>
</select> 学期: <select name="xq" size="1">
<option value=1 selected>第一学期</option>
<option value="2">第二学期</option>
<option value="3">第三学期</option>
<option value="4">第四学期</option>
<option value="5">第五学期</option>
</select>
科目:<select name="Kc" size="1">
<%
strSql = "SELECT * FROM suject"
Set rs222 = Server.CreateObject("ADODB.Recordset")
rs222.open strSql,conn,1,1
%><%
Do While Not rs222.EOF
%>
<option value="<%=rs222("name")%>" selected><%=rs222("name")%></option>
<%
rs222.movenext
loop
rs222.close
%>
</select>
<select name="By" size="1">
<option value="zp">总评成绩</option>
<option value="bukao1">第一次补考</option>
<option value="bukao2">第二次补考</option>
<option value="bukao3">第三次补考</option>
</select>
<select name="By0" size="1">
<option value="全部">全部</option>
<option value="及格">及格</option>
<option value="不及格">不及格</option>
</select>
<input type="submit" name="Submit" />
</td>
</form></table></table>
</td><table width="808" style="border-collapse: collapse" height="102">
<form name="form2" id="form2" method="post" action="KQLR.asp" target="_self">
<tr bgcolor="#009933">
<td width="20" bgcolor="#B1DB99" align="center" height="40" style="border: 1px solid #000000" rowspan="2">
ID</td>
<td width="110" bgcolor="#B1DB99" align="center" height="40" style="border: 1px solid #000000" rowspan="2">
班级</td>
<td width="102" bgcolor="#B1DB99" align="center" height="40" style="border: 1px solid #000000" rowspan="2">
学号</td>
<td width="49" bgcolor="#B1DB99" align="center" height="40" style="border: 1px solid #000000" rowspan="2">
姓名</td>
<td width="19" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
学期</td>
<td width="105" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
科目</td>
<td width="30" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
面授次数</td>
<td width="28" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
20%</td>
<td width="33" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
作业成绩</td>
<td width="31" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
10%</td>
<td width="30" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
考试成绩</td>
<td width="33" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
70%</td>
<td width="42" align="center" height="40" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
总评分</td>
<td width="138" align="center" height="20" bgcolor="#B1DB99" style="border: 1px solid #000000" colspan="3">
补 考</td>
</tr>
<tr>
<td width="42" align="center" height="21" bgcolor="#B1DB99" style="border: 1px solid #000000">
第一次</td>
<td width="44" align="center" height="21" bgcolor="#B1DB99" style="border: 1px solid #000000">
第二次</td>
<td width="38" align="center" height="21" bgcolor="#B1DB99" style="border: 1px solid #000000">
第三次</td>
</tr>
<% For i = 1 to LoopNum %>
<tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#FFFFCC'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="20">
<input type="checkbox" name="checkbox" value="<%=rs("id")%>" checked></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="110">
<%=rs("class")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="102">
<%=rs("sno")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="49">
<a href="DetailStudent_cj.asp?sno=<%=rs("sno")%>"><%=rs("name")%></a></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000"><%=rs("xueqi")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000">
<%=rs("kemu")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000"><%=rs("chuqincishu")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000">
<%=rs("chuqindefen")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000"><%=rs("zuoyefenshu")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="31"><%=rs("zuoyedefen")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="30">
<%=rs("kaoshifenshu")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="33">
<%=rs("kaoshidefen")%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="42">
<%if rs("zongpingfen") < 60 then %><font color=#FF0000> <%=rs("zongpingfen")%> </font><%else%><font color="#000080"> <%=rs("zongpingfen")%> </font> <%end if%></td>
</td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="42">
<%if rs("bukao1") < 60 then %><font color=#FF0000> <%=rs("bukao1")%> </font><%else%><font color="#000080"> <%=rs("bukao1")%> </font> <%end if%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="44">
<%if rs("bukao2") < 60 then %><font color=#FF0000> <%=rs("bukao2")%> </font><%else%><font color="#000080"> <%=rs("bukao2")%> </font> <%end if%></td>
<td align="center" height="25" bgcolor="#EBEBEB" style="border: 1px solid #000000" width="44">
<%if rs("bukao3") < 60 then %><font color=#FF0000> <%=rs("bukao3")%> </font><%else%><font color="#000080"> <%=rs("bukao3")%> </font> <%end if%></td>
</tr>
<% rs.movenext
Next %>
<tr>
<td colspan="16" bgcolor="#B3CBFF" width="0" height="23"><div align="center">
总共找到<%=Num%>条记录 <a href="index_student_kq.asp?page=1"><font color="#0000FF">首页</font></a><font color="#0000FF"> </font><a href="index_student_kq.asp?page=<%=page-1%>"><font color="#0000FF">上一页</font></a><font color="#0000FF"> </font><a href="index_student_kq.asp?page=<%=page+1%>&xueqi=<%=strxq%>&kemu=<%=strkc%>"><font color="#0000FF">下一页</font></a><font color="#0000FF"> </font><a href="index_student_kq.asp?page=<%=pageNum%>"><font color="#0000FF">尾页</font></a> 页次:<%=page%>/<%=pagenum%> 共<%=pageNum%>页</div></td>
</tr>
<tr>
<td colspan="16" bgcolor="#C2A6FF" width="0" height="20">
<p align="center">
<input type="submit" name="Submit" value=" 进入添加所选中学生的考勤次数 " style="border: 1pt solid #EEEEEE">
<input type="reset" name="Submit2" value=" 重新选择 " style="border: 1pt solid #EEEEEE"></td>
</tr>
</table>
<%
Else
%>
<table width="808" style="border-collapse: collapse">
<tr bgcolor="#009933">
<td colspan="12" bgcolor="#B3CBFF" height="24"> </td>
</tr>
<tr bgcolor="#009933">
<td width="68" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
学期</td>
<td width="123" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
科目</td>
<td width="57" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
面授次数</td>
<td width="45" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
20%</td>
<td width="57" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
作业成绩</td>
<td width="47" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
10%</td>
<td width="54" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
考试成绩</td>
<td width="39" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
70%</td>
<td width="45" align="center" height="34" bgcolor="#B1DB99" style="border: 1px solid #000000" rowspan="2">
总评分</td>
<td width="141" align="center" height="18" bgcolor="#B1DB99" style="border: 1px solid #000000" colspan="3">
补 考</td>
</tr>
<tr>
<td width="47" align="center" height="17" bgcolor="#B1DB99" style="border: 1px solid #000000">
第一次</td>
<td width="48" align="center" height="17" bgcolor="#B1DB99" style="border: 1px solid #000000">
第二次</td>
<td width="48" align="center" height="17" bgcolor="#B1DB99" style="border: 1px solid #000000">
第三次</td>
</tr>
<tr>
<td colspan="12" bgcolor="#EBEBEB" height="32" style="border: 1px solid #000000">
<p align="center">没有相关记录!</td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
</table>
<%
End If
%>
</body>
</html>