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

📄 cjtj_start.asp

📁 本人的课程设计。不足之处请大家指教。因为第一次用ASP有很多不足的地方。
💻 ASP
字号:
<!-- #include file="cookies.asp" -->
<!-- #include file="conn/conn.asp" -->
<html>
<head>
<title>成绩统计结果</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {
	font-size: medium;
	font-weight: bold;
}
body {
	background-color: #0099FF;
}
-->
</style>
</head>

<body text="#000000">
<%
'取试卷信息
set rs=server.createobject("adodb.recordset")
sql="select * from exam where ename='"&trim(request.querystring("ename"))&"' and eid='"&trim(request.querystring("eid"))&"'"
rs.open sql,conn,1,1
if not rs.eof then
	ename=trim(rs("ename"))
	eid=trim(rs("eid"))
	text=trim(rs("text"))
end if
rs.close
set rs=nothing

dim qidarray(1000)       '数组,记录题目id
i=0

'取题目数及题号
set rs=server.createobject("adodb.recordset")
sql="select * from question where qid in ( select qid from ex_que where ename='"&ename&"' and eid='"&eid&"' )"
rs.open sql,conn,1,1
c=rs.recordcount		'题目数
do while not rs.EOF     '循环记录题目id 到数组中
	qidarray(i)=trim(rs("qid"))   
	i=i+1
rs.MoveNext
loop
rs.close
set rs=nothing  


%>
<table width="70%" border="0" bgcolor="#FFFFFF" align="center">
  <tr> 
    <td> 
      <div align="center" class="style1"><%=trim(text)%> 成绩统计</div>
    </td>
  </tr>
<%
'取考试记录
set rs=server.createobject("adodb.recordset")
sql="select * from examstop where ename='"&ename&"' and eid='"&eid&"' order by score desc"
rs.open sql,conn,1,1
if not rs.eof then   
	scont=rs.recordcount     '考生人数
	t=0
	do while not rs.eof
		if trim(rs("pass"))="yes" then
		    t=t+1			 '记录答对人数
		end if
	rs.movenext
	loop

	rs.movefirst	'指针移至首记录,为最高分记录
	maxscore=trim(rs("score"))    '最高分
	maxrcont=trim(rs("rcont"))    '最高答对题数
%>
  <tr>
    <td bgcolor="#CCCCCC" height="30">共有考题:<%=c%>题</td>
  </tr>
	<tr> 
	  <td>参加考试人数:<%=trim(scont)%>人 , 考试最高分:<%=trim(maxscore)%>分 , 考生最高答对:<%=trim(maxrcont)%>题</td>
	</tr>
</table>
<table width="70%" border="0" align="center">
  <tr> 
    <td valign="top">
	  <table width="100%" border="0" align="center">
<%
else
   response.write "<script>window.alert('本试卷还没有学生交卷!');window.close();</script>"
end if
rs.close
set rs=nothing
%>
        <tr> 
          <td> <div align="center"><b>最高分考生</b></div></td>
        </tr>
      </table>

      <table width="100%" border="0" align="center" bgcolor="#CCCCCC" cellspacing="0" cellpadding="4">
        <tr bgcolor="#CCCCCC"> 
          <td>姓名</td>
          <td>学号</td>
		  <td>性别</td>
        </tr>
    <%
	 u=1
	 '取最高分考生
	 set rs=server.createobject("adodb.recordset")
	 sql="select * from examstop where ename='"&ename&"' and eid='"&eid&"' and rcont='"&maxrcont&"'"
	 rs.open sql,conn,1,1
	 if not rs.eof then
		 do while not rs.eof
			'取对应的考生信息
		   set rs1=server.createobject("adodb.recordset")
		   sql1="select * from student where id='"&trim(rs("id"))&"'"
		   rs1.open sql1,conn,1,1
		   if not rs1.eof then
			   if u mod 2=0 then     '颜色隔行交替显示
				color="#fffff"
				else
				color="#e4e4e4"
			   end if
			%>
			<tr bgcolor=<%=color%>> 
			  <td width="100"><%=trim(rs1("name"))%></td>
			  <td><%=trim(rs1("cid"))%></td>
			  <td><%=trim(rs1("sex"))%></td>
			</tr>
			<%
			rs1.close
			set rs1=nothing
			end if
		rs.movenext
		loop
	end if
	rs.close
	set rs=nothing
		%>
      </table>
    </td>
  </tr>
  <tr> 
    <td valign="top"><table width="100%" border="0" align="center">
        <tr> 
          <td height="19"> <div align="center"><b>考生答题正确率</b></div></td>
        </tr>
      </table>
      <table width="100%" border="0" align="center" bgcolor="#CCCCCC" cellspacing="0" cellpadding="4">
        <tr> 
          <td width="90%">题目</td>
          <td>题目正确率</td>
        </tr>
        <%
		'以下循环题目id 计算答题正确率
		 for i=0 to c-1
			 g=0
			 '取答对的人数
			 set rs=server.createobject("adodb.recordset")
			 sql="select * from studkey where qid='"&trim(qidarray(i))&"' and ename='"&ename&"' and eid='"&eid&"' and yesorno='yes'"
			 rs.open sql,conn,1,1
			 if not rs.eof then
				 g=rs.recordcount/scont      '计算正确率
				 g=left((g*100),5)         
			 end if
			 rs.close
			 set rs=nothing
			 if i mod 2=0 then     '颜色隔行交替显示
			 color="#ffffff"
			 else
			 color="#e4e4e4"
			 end if
		
			'取题目名称
			 set rs=server.createobject("adodb.recordset")
			 sql="select * from question where qid='"&trim(qidarray(i))&"'"
			 rs.open sql,conn,1,1
				qname=rs("qname")
			 rs.close
			 set rs=nothing
			 no=no+1    '题目序号
			'以下显示信息 %>
			<tr bgcolor="<%=color%>"> 
			  <td width="90%"><%=no%>. <%=qname%></td>
			  <td><%=g%>%</td>
			</tr>
			<%
		next
		%>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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