Android Question Mysql search using textbox

sigster

Active Member
Licensed User
Longtime User
Hi


if I use (2) LIKE 'jon%' then I get name start with jon
if I use (1) search from textbox I get all name start with j when I type jon I get to much like name start with jak

I am try to use query when I type the name

B4X:
    1.
    db.QueryASync("select * from staff where name like '" & text & "%' AND status Like '" & active & "%' ORDER BY name Asc;", 3)
    2.      
     db.QueryASync("Select * FROM staff WHERE name LIKE 'jon%' AND status Like '" & active & "%' ORDER BY name Asc;", 3)
 
Last edited:

sigster

Active Member
Licensed User
Longtime User
this is the code

I was try to use sample from the forum how I can search mysql
so far I can only search for the first letter then the listview are empty

sample


B4X:
Sub TxtSearchFilter_TextChanged (Old As String, New As String)
    Listv.sv.Visible = False  'Added because of the divider line flashing its full background color
    Wait For (FilterSearch(New)) Complete (Completed As Boolean)
    Listv.sv.Visible = True
End Sub

Sub FilterSearch (New As String) As ResumableSub


    Listv.Clear
    Sleep(0)

    If New.Length = 0  Then
            
    Else

            Dim act  = "active"
            db.QueryASync("select * from staff  where name LIKE '" & New & "%' AND status  Like '" & act  & "%' ORDER BY name Asc;", 3)           
            Wait For db_Ready   
    End If   
    Return True
    
End Sub
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
I am finish to fix this somthing I did no see
I was using If LabID.Text =

so when LabID change after first letter it stop search
 
Upvote 0
Top