Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何从数据库中获取选定值_Android_Sqlite - Fatal编程技术网

Android 如何从数据库中获取选定值

Android 如何从数据库中获取选定值,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+""}));

我只希望数据库中的选定值取决于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;
   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乔希:很好。同样亲爱的,如果你其他问题的答案已经解决了你的问题,也接受它们。原因如上所述。