📄 liststudenthomework.asp
字号:
<!-- #include file="utility/checkTeacher.asp" -->
<%
'****************************************
'目的: 列表显示所有作业信息
'开始时间: 2005-6-5 15:24
'最后修改时间: 2005-6-7 9:29
'编写人: 某某某
'****************************************
dim sql
dim rs
dim teacherID
'定义读取学生学号的语句
dim sqlForStu
'定义读取学生学号的RecordSet
dim rsForStu
dim pageSize '每页显示信息数目
dim pgnm '总共的页面数目
dim recordCount '总共的记录数
dim page '用户请求的页面索引
dim count '消息计数器,用来判断是否到达分页条目
dim link '把翻页链接地址保存在变量中
dim cName '搜索的课程名
dim cNamIS '是否严格匹配课程名
dim homeworkID '搜索的作业ID
cName = Request.QueryString("cName")
cNameIS = Request.QueryString("cNameIS")
homeworkID = Request.QueryString("homeworkID")
page = Request.QueryString("page")
teacherID = Session("userID")
count = 0
pageSize = 10
link = "listStudentHomework.asp?is=is"
sql = "select cName,courseID,homework,addTime,courseHomework.ID from courseHomework,course"
sql = sql & " where courseHomework.courseID = course.ID and course.tID = " & teacherID
'处理课程名搜索信息
if(cName <> "") then
if(cNameIS = "yes") then
sql = sql & " and cName = '" & cName & "'"
link = link & "&cName=" & cName & "&cNameIS=yes"
else
sql = sql & " and cName like '%" & cName & "%'"
link = link & "&cName=" & cName
end if
end if
'处理按作业编号匹配信息
if(homeworkID <> "") then
sql = sql & " and courseHomework.ID = " & homeworkID
link = link & "&homeworkID=" & homeworkID
end if
link = link & "&page="
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>已发信息列表</title>
<link rel="stylesheet" type="text/css" href="images/link.css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<div align="center">
<table border="1" width="700" id="table2" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="22">
<tr>
<td valign="bottom"> 当前操作: 学生作业列表</td>
</tr>
</table>
<br>
<%
'循环显示表格开始
set rs = ExecuteQuery(sql)
if(not rs.eof) then
rs.PageSize = pageSize
pgnm = rs.PageCount
recordCount = rs.RecordCount
if(IsEmpty(page) or cint(page) < 1 or cint(page) > pgnm) then
page = 1
end if
rs.absolutePage = page '指定当前页码
else
Alert("无符合条件的记录,请返回并访问其他页面!")
Go("welcome.htm")
Response.end
end if
do while(not rs.EOF and count <> pageSize)
%>
<table border="1" width="700" id="table1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="87" bordercolor="#CCCCCC">
<tr>
<td width="97" height="21" align="right" bgcolor="#F2F2F2">课程名:</td>
<td height="21" width="336" align="left"> <%=rs("cName")%></td>
<td height="21" width="82" align="center" bgcolor="#F2F2F2">
<p align="right">发布时间:</td>
<td height="21" width="211" align="left"> <%=rs("addTime")%></td>
</tr>
<tr>
<td width="97" align="right" height="21" bgcolor="#F2F2F2">作业内容:</td>
<td height="21" width="600" align="left" colspan="3"> <%=rs("homework")%></td>
</tr>
<%
'构造左外链接查询
sqlForStu = "SELECT A.stuID,B.homeworkContent,B.ID FROM" _
& "(SELECT stuID from stuCourse where courseID = " _
& rs("courseID") & ") as A LEFT JOIN " _
& "(SELECT * FROM stuHomework where homeworkID = " _
& rs("ID") & ") as B ON A.stuID = B.stuID"
set rsForStu = ExecuteQuery(sqlForStu)
%>
<tr>
<td width="97" align="right" height="21" bgcolor="#F2F2F2">已作答学生:</td>
<td width="600" align="center" height="21" colspan="3">
<table border="0" width="98%" id="table6" style="border-collapse: collapse">
<tr>
<td>
<%
while(not rsForStu.EOF)
if(rsForStu("homeworkContent") <> "") then
Response.write("<a href=showStuHomework.asp?stuHomeworkID=" _
& rsForStu("ID") & ">" & rsForStu("stuID") & "</a> ")
end if
rsForStu.MoveNext()
wend
rsForStu.close()
set rsForStu = nothing
%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="97" align="right" height="22" bgcolor="#F2F2F2">未作答学生:</td>
<td width="600" align="center" height="22" colspan="3">
<table border="0" width="98%" id="table7" style="border-collapse: collapse">
<tr>
<td>
<%
set rsForStu = ExecuteQuery(sqlForStu)
while(not rsForStu.EOF)
if(IsNull(rsForStu("homeworkContent"))) then
Response.write(rsForStu("stuID") & " ")
end if
rsForStu.MoveNext()
wend
rsForStu.close()
set rsForStu = nothing
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<%
'循环显示表格结束
rs.MoveNext()
count = count + 1
loop
rs.close()
set rs = nothing
%>
<table border="1" width="700" id="table5" style="border-collapse: collapse" bordercolor="#C0C0C0">
<tr>
<td>
<p align="right">
<%if page=1 then%> <font color="#CCCCCC">上一页</font><%else%>
<a href="<%Response.write(link & (page-1))%>">上一页</a><%end if%>
<%if page\pgnm=0 then%><a href="<%Response.write(link & (page+1))%>">下一页</a><%else%>
<font color="#CCCCCC">下一页</font><%end if%> 共<font color="#FF0000"><%=recordCount%></font>条信息,每页<font color="#FF0000"><%=pageSize%></font>条,共<font color="#FF0000"><%=pgnm%></font>页,<span lang="zh-cn">当前为第<font color="#FF0000"><%=page%></font>页,</span>跳转到<select name="page" onchange="MM_jumpMenu('this',this,0)" style="border:1px solid #8293E6; font-size: 9pt;width=62;height=16; color:#111111; background-color:#DDDDFF">
<option selected value="#">请选择</option>
<%for i=1 to pgnm%>
<option value="<%Response.write(link & i)%>">
第<%=i%>页</option>
<%next%></select>
</td>
</tr>
</table>
<br>
<table border="1" width="700" id="table4" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="49">
<tr>
<td valign="bottom" height="19" bgcolor="#F2F2F2" colspan="4"> 搜索面板:</td>
</tr>
<tr>
<td valign="middle" height="8" colspan="4"></td>
</tr>
<form action=listStudentHomework.asp method=get>
<tr>
<td valign="middle" height="24" width="70" align="right" bgcolor="#F2F2F2">
课程名:</td>
<td valign="bottom" height="24" width="264"> <input type="text" name="cName" class="inputTextShort" size="20" > <input type="checkbox" name="cNameIS" value="精确匹配" id="fp1"><label for="fp1">精确匹配</label></td>
<td valign="middle" height="24" width="95" align="right" bgcolor="#F2F2F2">
操作:</td>
<td valign="middle" height="24" width="264"> <input type=submit value="确定查询" name="OK" class="anniu">
<input type=reset value="重新填写" name="cancel" class="anniu"></td>
</tr>
</form>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -