www.gusucode.com > ASP+ACCESS在线考试系统设计(源代码+论文) > ASP+ACCESS在线考试系统设计(源代码+论文)\郭晓璇论文第二稿\test\randomuserresult.asp
<%@ Language=VBScript %> <% Session.TimeOut=200 name=session("user") jk=session("tab") dim score Set conn = Server.CreateObject("ADODB.Connection") conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("../试题库.mdb") set rs= server.createobject("adodb.recordset") ycorrect=0 rsCount=0 stzs=0 stzs=session("stzs") '修改当前成绩登记表情况 sql="select * from 成绩登记表" set base=conn.execute(sql) do while not base.eof sql="update 成绩登记表 set 当前状态='已交卷' where 试卷名称='"& session("user") & session("tab") &"'" conn.execute(sql) base.movenext loop sql= "create table "& name & jk &" (ID text(50),试题 memo,试题分数 text(10),答案 memo,试题ID text(50),用户答案 memo,用户得分 text(50),试题题型 text(50),附加参数 number) " conn.execute(sql) on error resume next tab1=session("tab") sql="select * from "& name & jk &"暂时" set base=conn.execute(sql) on error resume next J=0 df=0 m=0 n=0 score=0 do while not base.eof ID=base("试题ID") cs=base("附加参数") tm=base("试题") fs=base("试题分数") an=base("答案") tx=base("试题题型") daaa="" for i=1 to cs J=J+1 stid=id & "a" & i answer=request.form(stid) 'response.write "55" & answer answer=Ucase(answer) if tx="排序" then answer=trim(answer) end if if answer<>"" then daaa=daaa & answer end if if isnull(answer) or len(answer)=0 then answer="" end if answer=replace(answer,"'","‘") next sql="insert into "& session("user") & session("tab") &" (ID,试题ID,试题分数,试题,答案,用户答案,用户得分,试题题型,附加参数) values ("& j &","& ID &","& fs &",'"& tm &"','"& an &"','"& daaa &"','"& df &"','"& tx &"','"& cs &"')" conn.execute(sql) on error resume next if tx="判断" then if daaa="正确" then daaa=1 elseif daaa="错误" then daaa=0 else daaa="" end if end if daaa=replace(daaa," ","") an=replace(an," ","") if an=daaa then df=fs score=score+fs m=m+1 sql="update "& session("user") & session("tab") &" set 用户得分='"& df &"' where 试题ID='"& ID &"'" rs=conn.execute(sql) on error resume next else df=0 end if n=n+1 base.movenext df=0 loop 'if m=n then 'response.redirect "manfen.asp" 'end if Set conn = Server.CreateObject("ADODB.Connection") conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("../试题库.mdb") set rs=server.createobject("adodb.recordset") set rs.activeconnection=conn %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>答卷浏览</title> <meta name="GENERATOR" content="Microsoft FrontPage 3.0"> <meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0"> </head> <body bgproperties="fixed" background="../images/bgcolor.gif"> <form action="savepaper.asp" id="FORM9" method="post" name="FORM9"> <table border="0" width="100%"> <tr> <th width="100%" height="5%"><h1><font face="楷体_GB2312" color="##0000FF">答 卷 浏 览</font></h1></th> </tr> </table> <% sql="update 成绩登记表 set 成绩='"& score &"' where 用户名='"& name &"'" conn.execute(sql) %> <h2 align=center><font color=red><%response.write "本试卷,你的总分为"&score%></font></h2> 以下是你的答题情况,请阅目。 <br> <% sql="select * from "& session("user") & session("tab") &" where 试题题型='单项选择'" set base=conn.execute(sql) kk=0 dts=0 'base.movefirst if not base.eof then dts=dts+1 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>一、单项选择题</strong></font> </h2> <% end if do while not base.eof kk=kk+1%> <table border="0" width="100%"> <tr><td width="100%" height="5%">第<%Response.Write kk %>题: <%Response.Write base("试题")%>(<%Response.Write base("试题分数")%>分)</td> </tr> </table> <table border="0" width="100%"> <tr> <td width="50%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>正确答案:</strong></font></h3></td> <td width="50%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>你的答案:</strong></font></h3></td> </tr> </table> <table border="0" width="100%"> <tr> <td width="48%" height="5%"><% Response.Write base("答案") %> </td> <td width="4%" height="5%"></td> <td width="48%" height="5%"><% yhda="" for i=1 to base("附加参数") 'Response.Write i & ":" if not base.eof then Response.Write base("用户答案") Response.Write "<br>" yhda=yhda & base("用户答案") else exit for end if if base.eof then exit for else base.movenext end if next %> </td> </tr> </table> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/sail.gif" alt="sail.gif (725 bytes)" width="812" height="30"></td></tr> </table> <%loop%> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/30.gif" alt="30.gif (725 bytes)" width="811" height="12"></td></tr> </table> <p> <% sql="select * from "& session("user") & session("tab") &" where 试题题型='多项选择'" set base=conn.execute(sql) kk=0 if not base.eof then dts=dts+1 select case dts case 1 %> <font face="楷体_GB2312" color="#ff0000"><strong></p><h2>一、多项选择题</strong></font> </h2> <%case 2 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>二、多项选择题</strong></font> </h2> <% end select end if do while not base.eof kk=kk+1%> <table border="0" width="100%"> <tr> <td width="100%" height="5%">第<%Response.Write kk %>题: <%Response.Write base("试题")%>(<%Response.Write base("试题分数")%>分) </td> </tr> </table> <table border="0" width="100%"> <tr> <td width="52%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>正确答案:</strong></font></h3></td> <td width="48%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>你的答案:</strong></font></h3></td> </tr> </table> <table border="0" width="100%"> <tr> <td width="48%" height="5%"><% Response.Write base("答案") %></td> <td width="4%" height="5%"></td> <td width="48%" height="5%"><% if not base.eof then Response.Write base("用户答案") Response.Write "<br>" base.movenext end if %> </td> </tr> </table> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/sail.gif" alt="sail.gif (725 bytes)" width="813" height="30"></td></tr> </table> <%loop%> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/30.gif" alt="30.gif (725 bytes)" width="811" height="12"></td></tr> </table> <% sql="select * from "& session("user") & session("tab") &" where 试题题型='判断'" set base=conn.execute(sql) kk=0 if not base.eof then dts=dts+1 select case dts case 1 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>一、判断题</strong></font> </h2> <%case 2 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>二、判断题</strong></font> </h2> <%case 3 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>三、判断题</strong></font> </h2> <%end select end if do while not base.eof kk=kk+1%> <table border="0" width="100%"> <tr> <td width="100%" height="5%">第<%Response.Write kk %>题: <%Response.Write base("试题")%>(<%Response.Write base("试题分数")%>分) </td> </tr> </table> <table border="0" width="100%"> <tr> <td width="52%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>正确答案:</strong></font></h3></td> <td width="48%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>你的答案:</strong></font></h3></td> </tr> </table> <table border="0" width="100%"> <% if base("答案")=1 then %> <tr><td width="48%" height="5%">正确</td> <%else%> <tr><td width="48%" height="5%">错误</td> <%end if%> <td width="4%" height="5%"></td> <td width="48%" height="5%"><% for i=1 to base("附加参数") Response.Write i & ":" if not base.eof then Response.Write base("用户答案") Response.Write "<br>" else exit for end if if base.eof then exit for else base.movenext end if next %> </td> </tr> </table> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/sail.gif" alt="sail.gif (725 bytes)" width="813" height="30"></td></tr> </table> <%loop%> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/30.gif" alt="30.gif (725 bytes)" width="813" height="12"></td></tr> </table> <% sql="select * from "& session("user") & session("tab") &" where 试题题型='排序'" set base=conn.execute(sql) kk=0 if not base.eof then dts=dts+1 select case dts case 1 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>一、排序题</strong></font> </h2> <%case 2 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>二、排序题</strong></font> </h2> <%case 3 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>三、排序题</strong></font> </h2> <%case 4 %> <font face="楷体_GB2312" color="#ff0000"><strong><h2>四、排序题</strong></font> </h2> <%end select end if do while not base.eof kk=kk+1%> <table border="0" width="100%"> <tr> <td width="100%" height="5%">第<%Response.Write kk %>题: <%Response.Write base("试题")%>(<%Response.Write base("试题分数")%>分) </td> </tr> </table> <table border="0" width="100%"> <tr><td width="52%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>正确答案:</strong></font></h3></td> <td width="48%"><h3><font face="楷体_GB2312" color="#0000FF"><strong>你的答案:</strong></font></h3></td></tr> </table> <table border="0" width="100%"> <tr><td width="48%" height="5%"><% Response.Write base("答案") %></td> <td width="4%" height="5%"></td> <td width="48%" height="5%"><% for i=1 to base("附加参数") Response.Write i & ":" if not base.eof then Response.Write base("用户答案") Response.Write "<br>" else exit for end if if base.eof then exit for else base.movenext end if next %> </td> </tr> </table> <table border="0" width="100%" cellpadding="3"> <tr> <td width="100%"><img src="../Images/sail.gif" alt="sail.gif (725 bytes)" width="811" height="30"></td> </tr> </table> <%loop%> <table border="0" width="100%" cellpadding="3"> <tr><td width="100%"><img src="../Images/30.gif" alt="30.gif (725 bytes)" width="811" height="12"></td></tr> </table> <div align="center"> <h2 align=center><font color=red><%response.write "本试卷,你的总分为"&score%></font></h2> <h2><font color=red><a href="nosave.asp">不保存返回</a></font></h2> <h2><font color=red><a href="savepaper.asp">保存试卷并返回</a></font></h2> </div> </form> </body> </html>