Hi all,
I'd like to dynamically generate my WHERE statement to use in a query with DBUtils.ExecuteTableView.
Problem is I can't figure out how to properly write the LIKE clause.
Here it is my failing code:
What's get wrong is the third parameter ("?") which is evidently read as a question mark char, causing an ArrayIndexOutOfBound error since I pass in 3 parameters but the Where statement appears as having just 2 of them.
I know I could substitute that third ? with proper data (the same that goes in the arguments array, in my case fltDMov), but I'd like to kow which syntax (if any) to use in order to keep things as they are.
Thank you.
I'd like to dynamically generate my WHERE statement to use in a query with DBUtils.ExecuteTableView.
Problem is I can't figure out how to properly write the LIKE clause.
Here it is my failing code:
B4X:
Public Sub getWhereClause As String
Dim sb As StringBuilder
sb.Initialize
sb.Append(" where t1.datamv >=? AND t1.datamv <=? ")
If fltDMov <> "" Then sb.Append(" AND t1.descmv like '%?%' ")
Return sb.ToString
End Sub
I know I could substitute that third ? with proper data (the same that goes in the arguments array, in my case fltDMov), but I'd like to kow which syntax (if any) to use in order to keep things as they are.
Thank you.