I have variable:
String owner="Mike";
String[] columns ={"quantity", "price","owner"}
My cursor is trying to get
Cursor findEntry = db.query("sku_table", columns, "owner="+owner, null, null, null, null);
I got an error no such column error
android.database.sqlite.SQLiteException: no such column: owner: , while compiling: SELECT quantity, price, owner, FROM sku_table WHERE owner=Mike
But if I take this query:
SELECT quantity, price, owner, FROM sku_table WHERE owner=Mike
and add "" to Mike, and tested in sqlite browsers to execute the query, I do get back the row.
The working query looks like this:
SELECT quantity, price, owner, FROM sku_table WHERE owner="Mike"
Can somebody drop some insights about how do I incorporate double quotes? Other than use \”
Thanks!
Sorry, but that is exactly the reason why you should work with what the method offers! @Leandros and @Jake are helping in the totally wrong direction! Sorry to say that…
The only solution you should use is this:
ps: Yes I down voted both answers as they may work but providing a solution that shouldn’t be used.
Update:
If you need more than one where condition, just add it like you would do in a normal query
The order of the
?and thenew String[] {...}elements must be the same!