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 Sqlite中的where子句的更新操作中使用AND运算符?_Android_Sqlite_Where Clause - Fatal编程技术网

如何在Android Sqlite中的where子句的更新操作中使用AND运算符?

如何在Android Sqlite中的where子句的更新操作中使用AND运算符?,android,sqlite,where-clause,Android,Sqlite,Where Clause,我试图更新我的表,但它给了我一个错误,我如何在Where子句中使用AND运算符进行更新 这是我的密码 public static void updateData(long lday, String id, String usedamount, String trashedamount) { // TODO Auto-generated method stub ContentValues updatedValues = new ContentValues();

我试图更新我的表,但它给了我一个错误,我如何在Where子句中使用AND运算符进行更新

这是我的密码

public static void updateData(long lday, String id, String usedamount, String trashedamount) {
        // TODO Auto-generated method stub
        ContentValues updatedValues = new ContentValues();          

        updatedValues.put("usedamount", usedamount);
        updatedValues.put("trashedamount",trashedamount);

        // HERE I WANT TO USE AND OPERATOR FOR DAY AND ID
        // this and operator gives error


        db.update("info_table", updatedValues, DAY + "=" + lday AND ID + "=" + id, null);

    }
有人能帮我吗

您的AND运算符需要用引号括起来

public static void updateData(long lday, String id, String usedamount, String trashedamount) {
    ContentValues updatedValues = new ContentValues();          
    updatedValues.put("usedamount", usedamount);
    updatedValues.put("trashedamount",trashedamount);

    db.update("info_table", updatedValues, DAY + "=" + lday + " AND " + ID + "=" + id, null);
}

它不更新此代码db.updateinfo_表,updatedValues,DAY+=+lday和ID+=+ID,null;这是编译器错误吗?编辑您的问题并添加您收到的确切错误消息。我的意思是您在这里遇到了什么异常?分享例外情况它说这行有多个标记-原始类型long of lday没有字段IDyes这很好,但需要9分钟来接受答案:非常感谢。@Ert如果这对您有帮助,请接受答案