| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 542 人关注过本帖
标题:求助 一个ASP考试程序的判卷问题
只看楼主 加入收藏
lovesan
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-12-23
收藏
 问题点数:0 回复次数:1 
求助 一个ASP考试程序的判卷问题
我是这样写的 但多选题判分却不准
<%
'开始统计答对的题数
ycorrect=0
rsCount=1
id1=0
response.write "<hr color=purple>"
response.write"<br>单选结果统计:"
response.write "<hr color=purple>"
do while not id1>400
id1=id1+1
id=request.form("id"&id1)
if id<>"" then
sql8="select * from test where id='"&id1&"'"
response.write "<br>"
response.write "<b>题号:"&id1
response.write "<br>"
response.write "题目"
Set rs8=server.createobject("adodb.recordset")
rs8.open sql8,conn,1,3
da=rs8("ans")
tm=rs8("question")
a=rs8("a")
b=rs8("b")
c=rs8("c")
d=rs8("d")
e=rs8("e")
f=rs8("f")
response.write rscount
response.write "."&tm
response.write "</b><br>"
response.write "<hr>"
if a<>"" then
response.write "A."&a&"<br>"
end if
if b<>"" then
response.write "B."&b&"<br>"
end if
if c<>"" then
response.write "C."&c&"<br>"
end if
if d<>"" then
response.write "D."&d&"<br>"
end if
if e<>"" then
response.write "E."&e&"<br>"
end if
if f<>"" then
response.write "F."&f&"<br>"
end if
response.write "<br>"
response.write "<hr>"
response.write "正确答案:"&da
response.write "<br>"
da1=request.form("ans"&rscount)
response.write "你选择的答案:"&da1&"<br><br>"
response.write "<hr>"
if id=rs8("id") then
ys="#0066cc"
if request.form("ans"&rscount)=rs8("ans") then
ys="#FFFFFF"
ycorrect=ycorrect+1
else
rscount=rscount+1
end if
end if
end if
loop
response.write "<font color=#4e2972>单选题共得"&ycorrect
response.write "分<br>"
response.write "共"&rscount
response.write "道题"
response.write "<br>"
response.write "共答对"&ycorrect
response.write "道题</font><br>"
rs8.close
set rs8=nothing
%>
<%
ycorrect2=0
rsCounts=61
id2=0
response.write "<hr color=purple>"
response.write"<br>多选结果统计:"
do while not id2>500
id2=id2+1
id3=request.form("ids"&id2)
if id3<>"" then
sql9="select * from test where id='"&id3&"'"
response.write "<br>"
response.write "<hr color=purple>"
response.write "<b>题号:"&id3
response.write "<br>"
response.write "题目"
Set rs9=server.createobject("adodb.recordset")
rs9.open sql9,conn,1,3
da2=rs9("ans")
tm=rs9("question")
a=rs9("a")
b=rs9("b")
c=rs9("c")
d=rs9("d")
e=rs9("e")
f=rs9("f")
response.write rscounts-60
response.write "."&tm
response.write "</b><hr>"
response.write "<br>"
if a<>"" then
response.write "A."&a&"<br>"
end if
if b<>"" then
response.write "B."&b&"<br>"
end if
if c<>"" then
response.write "C."&c&"<br>"
end if
if d<>"" then
response.write "D."&d&"<br>"
end if
if e<>"" then
response.write "E."&e&"<br>"
end if
if f<>"" then
response.write "F."&f&"<br>"
end if
response.write "<hr>"
response.write "<br>"
response.write "正确答案"&da2
response.write "<br>"
y=", "
y1=""
da3=replace((request.form("dns"&rscounts)),y,y1)
rs9s=cstr(rs9("ans"))
response.write "你选择的答案:"&da3
response.write "<br><br>"
response.write "<hr>"
if id2=rs9("id") then
if cstr(da3)=rs9s then
ycorrect2=ycorrect2+1
rscount2=rscounts+1
else
rscount2=rscounts+1
end if
end if
end if
loop
rscounts=rscounts-60
response.write "<font color=#4e2972>多选题共得"&ycorrect2
response.write "分<br>"
response.write "共"&rscounts
response.write "道题"
response.write "<br>"
response.write "共答对"&ycorrect2
response.write "道题</font>"
%>
前面的单选题判分是正常的 但后面的多选就不正常了 分数永远都是0不知道哪错了 高手出来帮个忙   

补充一下 数据库中的答案是文本型的 格式是abc出题页面是用CHECKBOX来做的 输出的是a, b, c我用replace替换掉了多余的字符
可是运行后的结果是


正确答案abc
你选择的答案:abc

多选题共得0分
共1道题
共答对0道题
搜索更多相关主题的帖子: ASP 考试 
2007-12-23 16:14
hmhz
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:30
帖 子:1890
专家分:503
注 册:2006-12-17
收藏
得分:0 
你的循环语句写错了,上面使用do while not id2>500开始循环
下面就不能单独 loop
而是
movenext
loop
2007-12-24 13:04
快速回复:求助 一个ASP考试程序的判卷问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020178 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved