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);
精彩评论