Hi all.
I’m trying to use a Textbox with a Listbox and use this one for autocompletion.
At first, i’m connecting on my MySQL database and until any datas is matched, all works fine.
However if no data is matched, i’ve an error
In my TextField with KeyPressed method, i’ve this:
[code]
Dim Roomx_db As New MySQLCommunityServer
Dim r as RecordSet
Dim request As String
Roomx_db.DatabaseName=“roomx”
Roomx_db.Host=“x.x.x.x”
Roomx_db.UserName="???"
Roomx_db.Password="**********"
Roomx_db.Port=3306
If Roomx_db.Connect Then
ListBox_Name.DeleteAllRows
r = Roomx_db.SQLSelect("Select * From guest Where last_name like '"+Text_First_Name.Text+"%' Order by first_name")
If r <> Nil Then
r.movefirst
while not r.eof
ListBox_Name.AddRow ""
ListBox_Name.Cell(ListBox_Name.LastIndex,0) = r.field("last_name").stringvalue + " " + r.field("first_name").stringvalue
r.MoveNext
wend
else
ListBox_Name.Visible = False
end if
Roomx_db.Close
else
MsgBox “The database couldn’t be opened.”
end if[/code]
Look at the result here .
I don’t understand why because, the connection with the database seems to be disconnected after each key pressed.
If you could help me please.
Regards