I was trying to figure out a problem with an SQLite query and I found
that it was not working when I was using ? and a list of arguments.
Could someone tell me why these two version of the code doesn't return
the same thing:
public Cursor getTagCursor(int item) {
SQLiteDatabase db = getWritableDatabase();
String [] col = {"_id", "type", "value", "item"};
//VERSION 1 NOT WORKING
String [] arg = {String.valueOf(item)};
Cursor cursor = db.query ("tbl_tags", col, "item=?", arg, null,
null, "type ASC", null);
//VERSION 2 SUCCESSFUL
String test = "item="+String.valueOf(item);
Cursor cursor = db.query ("tbl_tags", col, test, null, null,
null,
"type ASC", null);
return cursor;
}
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en