用ASP开发一个在线考试程序(七)
类别: ASP教程
Result.asp
这一页的主要目的是显示结果,同时将这些结果插入数据库以备将来参考。
for each item in Request.Form
sql_check = "select Count(*) from "&subject&" where answer =\'" & Request.Form(item) & "\'"
Set RS_check = Application("Conn").Execute(sql_check)
if RS_check(0) > 0 then
result = result + 1
end if
next
变量result中存储了结果。
百分数是从result中算出来的,如下所示:
percent = round(( 100 * result )/count)
要将这个结果存储在数据库中,执行以下查询:
sql_id = "select id from loginuser where username=\'" & Session("username") &"\'"
Set RS_id = Application("Conn").Execute(sql_id)
id= RS_id(0)
SQL_insert = "insert into details (ref_id,subject,score) values(\'" & id & "\',\'" _
& subject & "\', \'" & percent &"\') "
Set RS_insert = Application("Conn").Execute(SQL_insert)
View.asp
观看模块检查会员是否以前曾经进行过在线考试。如果是的话,将用户引导到viewrecord.asp。如果没有的话,显示
相应的信息。
sql_id= "select id from loginuser where username=\'" & Session("username") &"\'"
Set RS_id = Application("Conn").Execute(sql_id)
id= RS_id(0)
sql_count = "Select count(*) from details where ref_id = \'" & id &"\'"
Set RS_count = Application("Conn").Execute(sql_count)
If RS_count(0) < > 0 Then
response.redirect "viewrecord.asp"
End If
If RS_count(0) = 0 Then
Session("noview") = "NO ONLINE EXAMINATIONS HAVE BEEN GIVEN"
response.redirect "default.asp"
End If
Viewrecord.asp
Viewrecord.asp页使会员能够观看一些他们的细节信息。查询如下:
sql_details = "Select *subject, score from details where ref_id = \'" & id &"\'"
Set RS_details = Application("Conn").Execute(sql_details)
结果是用一个简单的表格格式来显示的。
请注意,我并没有将会员可以进行一个主题的考试次数限制为一次。同一个主题考试可以进行任意次。
这一页的主要目的是显示结果,同时将这些结果插入数据库以备将来参考。
for each item in Request.Form
sql_check = "select Count(*) from "&subject&" where answer =\'" & Request.Form(item) & "\'"
Set RS_check = Application("Conn").Execute(sql_check)
if RS_check(0) > 0 then
result = result + 1
end if
next
变量result中存储了结果。
百分数是从result中算出来的,如下所示:
percent = round(( 100 * result )/count)
要将这个结果存储在数据库中,执行以下查询:
sql_id = "select id from loginuser where username=\'" & Session("username") &"\'"
Set RS_id = Application("Conn").Execute(sql_id)
id= RS_id(0)
SQL_insert = "insert into details (ref_id,subject,score) values(\'" & id & "\',\'" _
& subject & "\', \'" & percent &"\') "
Set RS_insert = Application("Conn").Execute(SQL_insert)
View.asp
观看模块检查会员是否以前曾经进行过在线考试。如果是的话,将用户引导到viewrecord.asp。如果没有的话,显示
相应的信息。
sql_id= "select id from loginuser where username=\'" & Session("username") &"\'"
Set RS_id = Application("Conn").Execute(sql_id)
id= RS_id(0)
sql_count = "Select count(*) from details where ref_id = \'" & id &"\'"
Set RS_count = Application("Conn").Execute(sql_count)
If RS_count(0) < > 0 Then
response.redirect "viewrecord.asp"
End If
If RS_count(0) = 0 Then
Session("noview") = "NO ONLINE EXAMINATIONS HAVE BEEN GIVEN"
response.redirect "default.asp"
End If
Viewrecord.asp
Viewrecord.asp页使会员能够观看一些他们的细节信息。查询如下:
sql_details = "Select *subject, score from details where ref_id = \'" & id &"\'"
Set RS_details = Application("Conn").Execute(sql_details)
结果是用一个简单的表格格式来显示的。
请注意,我并没有将会员可以进行一个主题的考试次数限制为一次。同一个主题考试可以进行任意次。
- 上一篇: 用ASP开发一个在线考试程序(六)
- 下一篇: 用ASP开发一个在线考试程序(八)
-= 资 源 教 程 =-
文 章 搜 索