Okay, Ill have to break this down a little bit, so you know what im on about!
My program is an app 4 kids. Its built in FMX and VB.NET.
When a user clicks on a button in the flash app (embedded into VB.NET form1) it opens a new form (form2) and connects to a database which holds questions for a quiz.
The thing is, I have to open it (form2), then close it, then open it again in order for the data pulled from the DB to be visible.
Why does it do this? Heres my code....
Thanks
My program is an app 4 kids. Its built in FMX and VB.NET.
When a user clicks on a button in the flash app (embedded into VB.NET form1) it opens a new form (form2) and connects to a database which holds questions for a quiz.
The thing is, I have to open it (form2), then close it, then open it again in order for the data pulled from the DB to be visible.
Why does it do this? Heres my code....
VB.NET:
If e.command = "Saxons" Then
F2.ShowDialog()
'set the connection variable
con = New OleDbConnection("Provider=Microsoft.Jet.OleDB.4.0;Data Source= C:\db.mdb;")
'open the connection
con.Open()
tablename = "Saxons"
subject = e.args
cmd = New OleDbCommand("SELECT * from " & tablename & " WHERE subject = '" & subject & "'", con)
reader_saxons = cmd.ExecuteReader
While reader_saxons.Read()
F2.question.Text = reader_saxons(2)
F2.answer1.Text = reader_saxons(3)
F2.answer2.Text = reader_saxons(4)
F2.answer3.Text = reader_saxons(5)
reader_saxons.Close()
con.Close()
End While
End If
Thanks