Result.asp 這一頁的主要目的是顯示結果,同時將這些結果插入數(shù)據(jù)庫以備將來參考。 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中存儲了結果。 百分數(shù)是從result中算出來的,如下所示: percent = round(( 100 * result )/count) 要將這個結果存儲在數(shù)據(jù)庫中,執(zhí)行以下查詢: 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頁使會員能夠觀看一些他們的細節(jié)信息。查詢如下: sql_details = "Select *subject, score from details where ref_id = '" & id &"'" Set RS_details = Application("Conn").Execute(sql_details) 結果是用一個簡單的表格格式來顯示的。