| |
||
В нем будет содержаться текст ответа:
Rows (J) .Item("AnswerText")
lcHTML2.Text = "<BR><BR>"
Dim DBConnas OleDbConnection Dim DBInsert As New OleDbCommand Dim DBCommand As OleDbDataAdapter Dim DSPageData as New DataSet Dim MyControl as Control Dim MyDDL as DropDownList Dim TotalCorrect as Integer Dim TotalQuestions as Integer Dim I as Integer DBConn = New OleDbConnection("Provider«sqloledb;" _ & "server=localhost;" _ & "Initial Catalog-INETC9;" _ & "User Id=sa;" _ & "Password=yourpassword;") For Each MyControl in pnlQuestions.Controls If MyControl.GetTypeO.FullName - _ "System.Web.UI.WebControls.DropDownList" Then TotalQuestions = TotalQuestions + 1 MyDDL = MyControl DBCommand = New OleDbDataAdapter _ ' ("Select CorrectAnswer From SectionQuestions Where " _ & "SectionQuestionID = " & Mid(MyDDL.ID, 2) , DBConn) DBCommand.Fill(DSPageData, _ "CorrectAnswer" & TotalQuestions) If MyDDL.Selectedltern.Text = ^_ DSPageData.Tables _ ("CorrectAnswer" & TotalQuestions). _ Rows(I).Item("CorrectAnswer") Then TotalCorrect = TotalCorrect + 1 End If End If Next DBInsert.CommandText = "Insert Into QuizResults (" _ & "StudentID, CourseSectionID, DateTaken, " _ & "Score, TotalQuestions) values (" _ & Session("StudentID") & ", " & Session("CourseSectionID") _ & ", GetDateO, " & TotalCorrect & ", " & TotalQuestions S ")" DBInsert.Connection = DBConn DBInsert.Connection.Open DBInsert.ExecuteNonQuery () Response.Redirect("./course.aspx") End Sub .
Dim MyDDL as DropDownList
Dim TotalQuestions as Integer
"System.Web.Ul.WebControis.DropDownList" Then |
||