Public Sub ques_change(ByVal quesid As Integer) maxques = Val(lbmaxques.Text) If quesid >= 1 Then ImageButton1.Enabled = True Else ImageButton1.Enabled = False End If 'if reaches maximum question If quesid = maxques Then ImageButton2.Enabled = False Else ImageButton2.Enabled = True End If get_ques(quesid) get_prev_ans(quesid) End Sub
Public Sub get_ques(ByVal quesid As Integer) str = "select * from quizdetails where quiz_id = '" & quizid & "'" cmdly.rst1 = New DataTable cmdly.rst1 = cmdly.executenonquery(str) str = "select * from quizquestion where quiz_id = '" & quizid & "' and ques_id = '" & quesid & "' order by ques_id" cmdly.rst2 = New DataTable cmdly.rst2 = cmdly.executenonquery(str) If cmdly.rst2.Rows.Count > 0 Then lbquescnt.Text = quesid lbques.Text = "Q. " & cmdly.rst2.Rows(0).Item("question").ToString cmdly.rst3 = New DataTable str = "select * from quizoption where quiz_id = '" & quizid & "' and ques_id = '" & cmdly.rst2.Rows(0).Item("ques_id") & "'" cmdly.rst3 = cmdly.executenonquery(str) If cmdly.rst3.Rows.Count > 0 Then i = cmdly.rst3.Rows.Count c = 0 quizlst.Items.Clear() While c < i Dim qlist As New System.Web.UI.WebControls.ListItem qlist.Text = cmdly.rst3.Rows(c).Item("optionVALUE").ToString qlist.Value = cmdly.rst3.Rows(c).Item("option_id").ToString quizlst.Items.Add(qlist) c = c + 1 End While End If End If End Sub <pre>
str = "select * from quizquestion where quiz_id = '" & quizid & " and ques_id = ( SELECT TOP 1 ques_id FROM quizquestion ORDER BY NEWID() )"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)