开发者

query to retrieve data from sqlite by using = operator

开发者 https://www.devze.com 2023-02-15 14:19 出处:网络
I am using a query to retrieve data from sqlite but I am getting an error. I am using following query:

I am using a query to retrieve data from sqlite but I am getting an error.

I am using following query:

cursor = db.query ( TABLE_NAME, new String[] { EMPLOYE开发者_StackOverflow社区E }, USERID + " =  " + NAME, null, null, null, null );


db.query(TABLE_NAME, new String[] { EMPLOYEE },USERID + " = '" + NAME + "'" , null, null, null, null);

USERID seems to be a string type. So, the value you are comparing should be surrounded by single quote


You can also retrieve data like this .

Cursor c = null;
        c = db.rawQuery("select field from tablename where field=" + your condition, null);
0

精彩评论

暂无评论...
验证码 换一张
取 消