⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 score_list.asp

📁 我们老师写的一个学生成绩管理系统
💻 ASP
字号:
<!--#include file="../inc/conn_open.asp"-->
<html>
<head>
<title>学生成绩管理系统欢迎您!</title>
<style type="text/css">
<!--
.STYLE1 {
	font-size: 26px;
	color: #990000;
}
.he0 {
	height: 20px;
	width: 80px;
	background-color: #F2F2F2;
}
.he1 {
	height: 25px;
	width: 50px;
	background-color: #F2F2F2;
}
body {
	background-color: #F2F2F2;
	margin-top: 0px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /></head>
<%
if session("sort")<>"教师" then
	%> 
<Script Language ="JavaScript">
			alert("对不起,您没有此项权限,请返回!!!");
			history.back();
		</Script>
	<%
	response.end
end  if 
%>
<%
'根据查询条件显示数据
Set  rs  =  Server.CreateObject("ADODB.Recordset")    
sql="select * from zongcj  where 1=1 "
'获取查询参数年级、学号、姓名,若有具体值则拼接sql语句。sname为模糊查询
grade=request("grade")
if grade<>"全部" and grade<>"" then
	sql=sql&" and left(sid,2)='"&grade&"'"
end if
sid=request("sid")
if sid<>"全部" and sid<>"" then
	sql=sql&" and sid='"&sid&"'"
end if
sname=request("sname")
if sname<>"" then
	sql=sql&" and sname like '%"&sname&"%'"
end if
'response.Write(sql)
rs.open  sql,conn,3,3
%>
<body>
<!--#include file="../inc/score_head.asp"--> 
<form name="form1" method="post" action="score_list.asp">
<table width="720" border="0" align="center" >
<tr>
    <td >请选择年级<select name="grade" class="he1">
      <option <%if grade="全部" then response.write("selected")%>>全部</option>
      <option <%if grade="03" then response.write("selected")%>>03</option>
      <option <%if grade="04" then response.write("selected")%>>04</option>
	  <option <%if grade="05" then response.write("selected")%>>05</option>
	  <option <%if grade="06" then response.write("selected")%>>06</option>
    </select>&nbsp;学号&nbsp;
	<select name="sid" class="he0">
		<option>全部</option>
	<%
		'取出学号,绑定到下拉列表
		Set  rssid  =  Server.CreateObject("ADODB.Recordset")    
		sqlsid="select username from yonghu  where sort='学生' order by username"
		rssid.open  sqlsid,conn,3,3
		while not rssid.eof 
			if rssid("username")= sid then
		%>
      		<option selected><%=sid%></option>
      <%else%>
      		<option><%=rssid("username")%></option>
      <%end if
	  		rssid.movenext
		wend
		rssid.close
		set rssid=nothing
	  %>
    </select>&nbsp;姓名&nbsp;<input  name="sname" type="text" class="he0"  size="30" />&nbsp;<input type="submit" name="Submit" value="查询" class="he1"></td>
    <td align="right" ><a href="score_ps_xz.asp">录入平时成绩</a>&nbsp;&nbsp;<a href="score_input.asp">录入总成绩</a></td>
</tr>
</table>
<table width="720" border="2" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#663300" bordercolordark="white">
  <tr>
    <td height="40" align="center">序号</td>
    <td align="center" >学号</td>
    <td align="center" >姓名</td>
    <td align="center" >平时成绩</td>
    <td align="center" >期末成绩</td>
    <td align="center" >总成绩</td>
    </tr>
	<%
			sum=1
			while not rs.eof  			  
	%>
  <tr>
    <td height="40" align="center"><%=sum%></td>
    <td align="center">&nbsp;<%=rs("sid")%></td>
    <td align="center">&nbsp;<%=rs("sname")%></td>
    <td align="center">&nbsp;<a href="score_ps_input.asp?update=y"><%=rs("psscore")%></a></td>
    <td align="center">&nbsp;<a href="score_input.asp?update=y"><%=rs("qmscore")%></a></td>
    <td align="center">&nbsp;<%=rs("score")%></td>
    </tr>
<%
				sum=sum+1
				rs.movenext
			wend
			rs.close
			set rs=nothing
			'查询平时成绩、期末成绩、总成绩平均值,显示在最后一行,查询参数同上。	
			 avgps=0
			 avgqm=0
			 avgzcj=0
			Set  rsavg  =  Server.CreateObject("ADODB.Recordset")    
			sqlavg="select  isnull(avg(psscore),0) as psscore, isnull(avg(qmscore),0) as qmscore, isnull(avg(score),0) as score from zongcj where (psscore>0 or qmscore>0 or score>0) "
			if grade<>"全部" and grade<>"" then
				sqlavg=sqlavg&" and left(sid,2)='"&grade&"'"
			end if
			if sid<>"全部" and sid<>"" then
				sqlavg=sqlavg&" and sid='"&sid&"'"
			end if
			if sname<>"" then
				sqlavg=sqlavg&" and sname like '%"&sname&"%'"
			end if
			rsavg.open  sqlavg,conn,3,3
			if not rsavg.eof  then
					avgps=rsavg("psscore")
					avgqm=rsavg("qmscore")
					avgzcj=rsavg("score")
			end if
			rsavg.close
			set rsavg=nothing
				  %>
  <tr>
    <td height="40" align="center">总评</td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
    <td align="center"><%=FormatNumber(avgps,0)%>&nbsp;</td>
    <td align="center"><%=FormatNumber(avgqm,0)%>&nbsp;</td>
    <td align="center"><%=FormatNumber(avgzcj,0)%>&nbsp;</td>
    </tr>
</table>
</form>
</body>
</html>
<!--#include file="../inc/conn_close.asp"-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -