How to get selected values from database
I want only selected values form database depends upon i and j?
public Cursor getAll() {
int i=2;j=1;
return (getReadableDatabase().rawQuery(
开发者_运维知识库 "SELECT _id,note,answer From Notes where _id=? AND note=?",new String[]{i+""},new String[]{j+""}));
}
Try this.
public Cursor getAll() {
int i=2;
return (getReadableDatabase().rawQuery(
"SELECT _id,note,answer From Notes where _id=? ",new String[]{i+""}));
}
For multiple arguments...
public Cursor getAll() {
int i=2;j=1;
return (getReadableDatabase().rawQuery(
"SELECT _id,note,answer From Notes where _id=? AND note=?",new String[]{i+"", j+""}));
}
精彩评论