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

How to use AND operator in update operation for where clause in Android Sqlite?

我正在尝试更新我的 table,但它给了我一个错误,我如何在 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);
}