急!!!asp写的考试系统自动评分的代码,无论答案对错都是零分!跪求高手帮忙解决问题!!!!
<!--从testpaper.asp中的三个隐含变量中取得数值--><%Subject=Request("Subject")'response.writeSubjectS...
<!--从testpaper.asp中的三个隐含变量中取得数值-->
<%
Subject=Request("Subject")
'response.write Subject
StudentID=Request("StudentID")
Name=Request("Name")
%>
<html><style type="text/css">
</style>
<body leftmargin="100">
<center>
<div >
<h2><%=Name%>,你的考试成绩如下表:</h2>
<%
'session.timeout=10'session对象的超时值
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("index.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
%>
<%
sql="Select * From "&Subject&" order by 题目序号"
'response.write sql
rs.open sql,conn,2,2
score=0
while not rs.EOF
answer=rs("正确答案")
'response.write "本题答案:"&answer
select case rs("题目类型")
case 1:
selection=Request("No"&rs("题目序号"))
'response.write "所给:"&selection&"<br>"
case 2:
selection=""
for n=1 to 4
if not Request("No"&rs("题目序号")&"-"&n)="" then
selection=selection&Request("No"&rs("题目序号")&"-"&n)
end if
next
'response.write "所给:"&selection&"<br>"
case 3:
selection=Request(rs("选择项1")) '选择项1存放填空题的名称
' response.write "所给:"&Request(rs("选择项1"))
case else:response.write"<b>其他题目还未确定评分规则!</b>"
end select
if answer=selection then
' response.write "right!<br>"
score=score+rs("本题分数")
'response.write "<b>"&score&"</b><br>"
'else response.write "<b>wrong!</b><br>"
end if
rs.movenext
wend
rs.close
%>
这一句if answer=selection then
' response.write "right!<br>"
score=score+rs("本题分数")根本不执行! 展开
<%
Subject=Request("Subject")
'response.write Subject
StudentID=Request("StudentID")
Name=Request("Name")
%>
<html><style type="text/css">
</style>
<body leftmargin="100">
<center>
<div >
<h2><%=Name%>,你的考试成绩如下表:</h2>
<%
'session.timeout=10'session对象的超时值
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("index.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
%>
<%
sql="Select * From "&Subject&" order by 题目序号"
'response.write sql
rs.open sql,conn,2,2
score=0
while not rs.EOF
answer=rs("正确答案")
'response.write "本题答案:"&answer
select case rs("题目类型")
case 1:
selection=Request("No"&rs("题目序号"))
'response.write "所给:"&selection&"<br>"
case 2:
selection=""
for n=1 to 4
if not Request("No"&rs("题目序号")&"-"&n)="" then
selection=selection&Request("No"&rs("题目序号")&"-"&n)
end if
next
'response.write "所给:"&selection&"<br>"
case 3:
selection=Request(rs("选择项1")) '选择项1存放填空题的名称
' response.write "所给:"&Request(rs("选择项1"))
case else:response.write"<b>其他题目还未确定评分规则!</b>"
end select
if answer=selection then
' response.write "right!<br>"
score=score+rs("本题分数")
'response.write "<b>"&score&"</b><br>"
'else response.write "<b>wrong!</b><br>"
end if
rs.movenext
wend
rs.close
%>
这一句if answer=selection then
' response.write "right!<br>"
score=score+rs("本题分数")根本不执行! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询