I keep trying to use wildcards in a search in an android app, and keep running into errors.
I’m performing a search on my application using the string below:
Cursor c_name = b.query("namedrxns", new String[] { "_id", "name" },
"name LIKE %?%", new String[] { query }, null, null, null);
when I use name LIKE %?% or name=%?% I get a “near “%”: syntax error: , while compiling: SELECT _id, name FROM namedrxns WHERE name=%?%” error.
but with name LIKE '%?%' or name='%?%' I get instead “bind or column index out of range: handle 0x40cb70”
Could someone please tell me what I’m doing wrong?
Thanks!
Append the
%to thequeryparameter.I.E.:
Like Thomas Mueller already said, please note that
%and_within the value still work as wildcards.