欢迎光临
我们一直在努力

网络考场(6)(转)stselectsub.asp

建站超值云服务器,限时71元/月

<%@ 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
strsql="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>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 网络考场(6)(转)stselectsub.asp
分享到: 更多 (0)

相关推荐

  • 暂无文章