Need help with DBUtils.ExecuteListView parameter for the WHERE clause

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

I would like to use the value from an EditText box to filter a ListView.

Can you look at my coding and let me know what else I need to do to get it to work?

So far it only returns 0 rows.

B4X:
Sub ButtonSearchFilterEventHandler_Click
   
   ' Populate the list.
   '-------------------
   DBUtils.ExecuteListView(SQL, "SELECT Id, ResultDescription " & _
                           "FROM VisitResultTypes " & _
                           "WHERE ResultDescription = ? " & _
                        "ORDER BY ResultDescription", _
      Array As String(EditTextResultDescription.Text), 0, ListViewResults, True)
End Sub

Thanks.
 

vb1992

Well-Known Member
Licensed User
Longtime User
"WHERE ResultDescription like ? " &

might help..



also fool around with the wildcards which is most likely %

ex: select * from tablename where name like '%kim%'
 
Last edited:
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
Hi vb1992,

Thanks for the reply.

I used this and it worked.

B4X:
   DBUtils.ExecuteListView(SQL, "SELECT Id, ResultDescription " & _
                           "FROM VisitResultTypes " & _
                           "WHERE ResultDescription LIKE " & "'" & EditTextSearchFilter.Text & "%' " & _
                        "ORDER BY ResultDescription", _
      Null, 0, ListViewResults, True)
 
Upvote 0
Top