What is the proper syntax than? I tried all the examples from the tutorial and nothing works.
What is the proper syntax for this:
question = SQL1.ExecQuerySingleResult("SELECT question FROM trivia where ID = ?",NewNumber)
question = SQL1.ExecQuerySingleResult2("SELECT question FROM trivia where ID = ?",Array As String(NewNumber))
NumberList.Clear ' added as per post #18
For i = 1 To 73
NumberList.Add (i) ' add the numbers to the list
Next
Dim NumberList As List
NumberList.Initialize
When it gets to the end of the list it error out. How do I check to see if there are any numbers left?
Here is the line it errors out on.
i = Rnd (0, NumberList.Size )
Dim i As Int
Dim NewNumber As Int
If NumberList.Size = 0 Then
MsgBox ("No questions left","Stop getting questions")
Return
End If
i = Rnd (0, NumberList.Size ) ' random pointer to somewhere in the list
NewNumber = NumberList.Get (i) ' get the number
NumberList.RemoveAt (i) ' remove the number from the list
' you can now use NewNumber for your question. Note this does not check for the list being empty
Dim answers(4) As Int
question = SQL1.ExecQuerySingleResult2("SELECT question FROM trivia where ID = ?",Array As String(NewNumber))
a(0) = SQL1.ExecQuerySingleResult2("SELECT answer FROM trivia where ID = ?",Array As String(NewNumber))
a(1) = SQL1.ExecQuerySingleResult2("SELECT wrong1 FROM trivia where ID = ?",Array As String(NewNumber))
a(2) = SQL1.ExecQuerySingleResult2("SELECT wrong2 FROM trivia where ID = ?",Array As String(NewNumber))
a(3) = SQL1.ExecQuerySingleResult2("SELECT wrong3 FROM trivia where ID = ?",Array As String(NewNumber))
lblQuestion.Text = question
For i = 0 To 3
answers(i) = i
Next
For i = 0 To 3
k = Rnd(i, 4)
x = answers(i)
answers(i) = answers(k)
answers(k) = x
Next
answer1.Text = a(answers(0)) 'assuming answer1 etc are button names
answer2.Text = a(answers(1))
answer3.Text = a(answers(2))
answer4.Text = a(answers(3))
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?