Android 如何从数据库中获取选定值
我只希望数据库中的选定值取决于I和jAndroid 如何从数据库中获取选定值,android,sqlite,Android,Sqlite,我只希望数据库中的选定值取决于I和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+""}));
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+""}));
}
试试这个
public Cursor getAll() {
int i=2;
return (getReadableDatabase().rawQuery(
"SELECT _id,note,answer From Notes where _id=? ",new String[]{i+""}));
}
对于多个参数
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+""}));
}
接受一些答案,尤其是下面的答案,如果它现在对你有用。@Puneet Joshi,dude接受答案,否则你会失去专家的信心,他们会犹豫回答你的问题questions@Puneet乔希:很好。同样亲爱的,如果你其他问题的答案已经解决了你的问题,也接受它们。原因如上所述。