网络考场(6)(转)stselectsub.asp
发表于:2007-06-30来源:作者:点击数:
标签:
%@ Language= VB Script % % if Request.Form(selsub) then ‘’如果选择了考科目,则进入考试界面 marray=split(Request.Form(selsub),,) ‘’保存考试科目的教师编号 session(teachid)=trim(marray(0)) ‘’保存考试科目名称 session(subname)=trim(marray(
<%@ Language=
VBScript %>
<%
if Request.Form("selsub")<>"" then
‘’如果选择了考科目,则进入考试界面
marray=split(Request.Form("selsub"),",")
‘’保存考试科目的教师编号
session("teachid")=trim(marray(0))
‘’保存考试科目名称
session("subname")=trim(marray(1))
‘’保存考题数量
session("testnum")=trim(marray(2))
‘’保存考试时间
session("testtime")=trim(marray(3))
‘’保存开始时间
session("starttime")=now()
‘’进入考试界面
Response.Redirect "screatefrm1.asp"
end if
%>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</head>
<body>
<form action="stselectsub.asp" method="post" id="form1" name="form1">
<p><font face ="" size="2">你已经进入
网络考场,必须遵守考场规则,注意考试时间</font></p>
<STRONG><FONT size=4 color=blueviolet face=隶书>
<%Response.Write session("stname")%>
</FONT></STRONG>
<p align=center>
<table border="1" cellPadding="1" cellSpacing="1" width="75%">
<tr>
<
td colSpan="3">
<div align="center"><FONT color=crimson face=幼圆
size=4><STRONG>选择考试科目</STRONG></FONT></div>
<tr>
<td>科目</td>
<td>任课老师</td>
<td>考试时间</td></tr>
<%
‘’创建两个
数据库连接对象conn和conn2
set conn=server.CreateObject("adodb.connection")
set conn2=server.CreateObject("adodb.connection")
conn2.ConnectionString="dsn=testsys"
conn.ConnectionString="dsn=testsys"
conn.Open
conn2.Open
str
sql="select subinfo.sub,subinfo.teachid,subinfo.testtime,subinfo.testnum,teacherinfo.teachname from subinfo,teacherinfo where subinfo.teachid=teacherinfo.teachid"
‘’第一个数据库连接对象查询所有的考试科目信息(包括名称、考试时间、题目数量、开课教师的姓名及编号
set mrs=conn.Execute(strsql)
while not mrs.eof
Response.Write "<tr>"
‘’第二个数据库连接对象查询相应科目学生是否已经有了成绩
set mrs2=conn.Execute("select * from score where stid=‘’" & session("stid") & "‘’ and sub=‘’" & mrs("sub") & "‘’ and teachid=‘’" & mrs("teachid") & "‘’")
if not mrs2.eof then
‘’如果相应科目学生已有了成绩,则标识为已考
Response.Write "<td>" & mrs("sub") & "已考(" & mrs2("score") & ")" & "</td>"
else
‘’否则提供radio选择考试科目,每个radio的value之中包含考试科目的信息
‘’(如开课教师的编号,课程名称,考试时间及数量)
Response.Write "<td><input name=selsub type=radio value=" & mrs("teachid") & "," & mrs("sub") & "," & mrs("testnum") & "," & mrs("testtime") & ">" & mrs("sub") & "</td>"
end if
set mrs2=nothing
Response.Write "<td>" & mrs("teachname") & "</td>"
Response.Write "<td>" & mrs("testtime") & "</td></tr>"
mrs.movenext
wend
‘’关闭数据库连接
conn.Close
conn2.Close
‘’清空对象变量
set conn=nothing
set conn2=nothing
%>
</table></p>
<p> <input id="submit1" name="submit1" type="submit" value="确认"></p>
</form>
</body>
</html>
原文转自:http://www.ltesting.net