<% Function displayAnswers(sQuizID) //Get connected to the database Set connection = Server.CreateObject("ADODB.Connection") connection.mode = 1 //Read Only Mode sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=c:/inetpub/wwwroot/rocks/_private/Quizzes.mdb" connection.Open(sConnectionString) //Create the command sCommand = "SELECT * FROM Answers WHERE QuizID = " _ & sQuizID & " ORDER BY Question" //Issue the command Set rsAnswers = connection.Execute(sCommand) //Check for Errors if (connection.errors.count > 0) then Response.Write("displayAnswers connection error...") else //Create a table cell to contain the report sPrint = "
" _ & "
Question
" _ & "
Answer
" _ & "
Judgment
" Response.Write(sPrint) do until rsAnswers.EOF //Get the fields from this record iQuestionNumber = rsAnswers("Question") sAnswer = rsAnswers("Answer") sJudgment = rsAnswers("Judgment") if (sJudgment = True) then sJudgment = "OK" else sJudgment = "Wrong" end if //Print this answer's report sPrint = "
" & iQuestionNumber _ & "
" & "
" & sAnswer & "
" _ & "
" & sJudgment & "
" Response.Write(sPrint) //Move to the next record rsAnswers.MoveNext loop //Close the table sPrint = "
" Response.Write(sPrint) end if //Close the connection connection.Close() End Function %>