<% function displayAnswers(sQuizID) { //Get connected to the database 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 rsAnswers = connection.Execute(sCommand); //Check for Errors if (connection.errors.count > 0) Response.Write("displayAnswers connection error..."); else { //Create a table cell to contain the report sPrint = "
" + "
Question
" + "
Answer
" + "
Judgment
"; Response.Write(sPrint); while (!rsAnswers.EOF) { //Get the fields from this record iQuestionNumber = rsAnswers("Question"); sAnswer = rsAnswers("Answer"); sJudgment = rsAnswers("Judgment"); if (sJudgment == 1) sJudgment = "OK"; else sJudgment = "Wrong" //Print this answer's report sPrint = "
" + iQuestionNumber + "
" + "
" + sAnswer + "
" + "
" + sJudgment + "
"; Response.Write(sPrint); //Move to the next record rsAnswers.MoveNext; } //Close the table sPrint = "
"; Response.Write(sPrint); } //Close the connection connection.Close(); } %>