We're still on the first stage...We are working on the quiz module right now..
My problem is we were not able to generate questions randomly from our database which is SQL..We can actually retrieve data from the database in sequence..Kindly help us modify our code for our main concern...which will allow the program to generate random questions from the database, we are using option buttons for the choices.(optional--->>will be able to choose the correct answer and compute for the score...). By the way, we are using VB 6.0.
Hoping for your response as soon as possible! thank you so much!
Below is our code for the Quiz.Kindly check this out..tnx
Option Explicit Dim lessnum As Integer Sub S_LOAD_con() Dim rsless As New ADODB.Recordset Dim strsql As String strsql = "select quiznum, quizquestion, choice1,choice2,choice3,choice4 from quizmaintenance" rsless.Open strsql, conn lblquiznum.Caption = rsless!quiznum txtQuestion.Text = rsless!quizquestion optChoice(0).Caption = rsless!choice1 optChoice(1).Caption = rsless!choice2 optChoice(2).Caption = rsless!choice3 optChoice(3).Caption = rsless!choice4 rsless.Close End Sub Private Sub cmdOK_Click() Dim rsless As New ADODB.Recordset Dim strsql As String lessnum = lessnum + 1 strsql = "select quiznum, quizquestion, choice1,choice2,choice3,choice4 from quizmaintenance" & _ " where quiznum = '" & lessnum & " ' " rsless.Open strsql, conn If rsless.EOF = False Then lblquiznum.Caption = rsless!quiznum txtQuestion.Text = rsless!quizquestion optChoice(0).Caption = rsless!choice1 optChoice(1).Caption = rsless!choice2 optChoice(2).Caption = rsless!choice3 optChoice(3).Caption = rsless!choice4 Else MsgBox "Youve Finish The Quiz?", vbOkOnly cmdOK.Enabled = False Exit Sub End If rsless.Close End Sub Private Sub Form_Load() lessnum = 1 S_LOAD_con End Sub
Mod Edit: Please use code tags when posting your code. Code tags are used like so =>
Thanks,
PsychoCoder

New Topic/Question
Reply




MultiQuote



|