Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.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 多where子句失败_Android_Database - Fatal编程技术网

Android 多where子句失败

Android 多where子句失败,android,database,Android,Database,在我的代码中,我有一个数据库,当我用KEY\u DESC=userselectvalue检索行时,它工作了。但当我试图检索具有多个“where”条件的行时,它失败了。我曾经在列表视图中显示检索到的元素。请帮帮我。没有显示错误。但是列表视图为空 public Cursor fetchEventByName(String inputText,String inputText1) throws SQLException { //Log.w(TAG, inputText);

在我的代码中,我有一个数据库,当我用
KEY\u DESC=userselectvalue
检索行时,它工作了。但当我试图检索具有多个“where”条件的行时,它失败了。我曾经在
列表视图中显示检索到的元素。请帮帮我。没有显示错误。但是
列表视图
为空

 public Cursor fetchEventByName(String inputText,String inputText1) throws SQLException {
        //Log.w(TAG, inputText);
        SQLiteDatabase db = this.getReadableDatabase();

        Cursor mCursor = null;
        if ((inputText == null || inputText.length () == 0) && (inputText1 == null || inputText1.length () == 0 ) ){
        mCursor = db.query(DATABASE_TABLE, new String[] {KEY_ROWID,
                KEY_DESC, KEY_EVENT, KEY_DATE },
        null, null, null, null, null);
        }
        else {

            String [] temp = new String[] {KEY_ROWID,
                    KEY_DESC, KEY_EVENT, KEY_DATE};
        mCursor = db.query(false,DATABASE_TABLE,temp ,
                KEY_DESC + " = '" + inputText + "'" + " AND " + KEY_DATE + " = '" + inputText1+ "'", null, null, null, null, null);


        }

        if (mCursor != null) {
        mCursor.moveToFirst();
        }
        return mCursor;
   }

您可以通过直接传递sql查询来尝试db.rawQuery

表中的值与关键字说明和关键字日期的条件不匹配。你能发布表格的内容以及inputText和InputExt1的内容吗?