开发者

query to retrieve data from sqlite by using = operator

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜