📄 exam_result.asp
字号:
<%@ Language=VBScript %>
<%
dim userid
userid = Session("userid")
if userid="" then
Response.Redirect("exam_login.htm")
end if
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<table>
<tr><td style="WIDTH: 500px" width=500 bgColor=gold
><P align=right><strong><font size="4">考试结果</font></strong> </P></td></TD>
</tr>
</table>
<!-- #INCLUDE FILE = "connect_ama.asp" -->
<%
num=Session("Questions")
qq=Session("Counter")
anss=Session("Answers")
totalq=Session("totalQuestions")
if Session("examover")="0" then
anss(qq-1)=Request.Form("answer")
Session("Answers")=anss
end if
Session("examover")=1
total_q=10 'total questions take it from databse
correct_ans=0
incorrect_ans=0
notattempted_ans=0
for i=1 to totalq
set rs=myconn.Execute("select * from q_bank where q_id=" & num(i))
if anss(i)=rs("answer") then
correct_ans=correct_ans+1
elseif anss(i)="Not Attempted" then
notattempted_ans=notattempted_ans+1
end if
incorrect_ans=totalq-(correct_ans+notattempted_ans)
next
scorepercent =(100*correct_ans)/totalq
%>
<br>
<TABLE cellSpacing=1 cellPadding=1 width=500>
<TR>
<TD>
用户名:<%=userid%><br>
考试日期:<%=date%><br><br>
总问题 = <%=totalq%><br>
回答正确 = <%=correct_ans%><br>
回答错误 = <%=incorrect_ans%><br>
没有作答 = <%=notattempted_ans%><br>
</TD>
<TD>
<APPLET code=ChartApp width=220 height=300 VIEWASTEXT>
<PARAM NAME="incorrect" VALUE="<%=(100*incorrect_ans)/totalq%>">
<PARAM NAME="correct" VALUE="<%=(100*correct_ans)/totalq%>">
<PARAM NAME="notattempted" VALUE="<%=(100*notattempted_ans)/totalq%>">
</APPLET>
</TD></TR></TABLE><br>
<br>
<form action="exam_summary.asp" method=post>
<INPUT type=submit value="View complete Exam Summary" ></form>
<A href="exam_instructions.asp">Take a New Exam ....</A>
<table>
<%myconn.close
set myconn=Server.CreateObject("ADODB.Connection")
myconn.ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;data source=(local);User ID=sa;Initial Catalog=exam"
myconn.Open
dim myrs
set myrs = server.createobject("ADODB.recordset")
myrs.open "select * from userexams",myconn,1,3
''removing 1,3 will give error!
''''''''''''''''''''''''''''''''''''''''''''''''''
myrs.addnew
myrs("userid").value= userid
myrs("testdate")= date
myrs("examname")= session("examname")
myrs("percentage")= scorepercent
if scorepercent < cint(Session("ppercentage")) then
myrs("status")= "FAILED"
resultmess="You have FAILED in the Exam !!"
else
myrs("status")= "CLEARED"
resultmess="You have CLEARED in the Exam !!"
end if
myrs.update
'''''''''''''''''''''''''''''''''
'closing order important'''''''''
myrs.close
myconn.close
set myconn=nothing
set myrs=nothing
'''''''''''''''''''''''''''''''''
%>
<tr><td style="WIDTH: 500px" width=500 bgColor=gold
><P align=right><FONT size=4><STRONG>
<U><%= resultmess%></U></STRONG></FONT> </P></td></TD>
</tr>
</table>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -