SQLite .query() method, WHERE clause is only taking double quotes strings

前端 未结 6 597
执笔经年
执笔经年 2020-12-14 20:43

I have variable:

String owner=\"Mike\";
String[] columns ={\"quantity\", \"price\",\"owner\"}

My cursor is trying to get
Curso

6条回答
  •  一生所求
    2020-12-14 21:26

    I know this is an old question, but you can also do it like this:

    Cursor findEntry = db.query("sku_table", columns, "owner=\'"+owner+"\'", null, null, null, null);

    I just did it in my app and it worked as expected.

    Jake's answer was similar, but probably wouldn't work without the \ before the '

提交回复
热议问题