jeudi 28 janvier 2016

Android Update Statement

Im using a simple function that receives to parameters (a String and an int). The table contains two rows, one a name and the second a value. I would like to update the row matching the string passed in with a new value (Current value - int passed in).

What I have at the moment is below, when I run I get no errors but the results arent changing. I am just wondering if

Query

public boolean deductIngredient(String ingredient, int measurement)
{
    db.rawQuery("update kitchen set measurement = measurement - "+measurement+" where kitchen.ingredient_name = " + "'"+ingredient+"'", null);
    return true;
}

Aucun commentaire:

Enregistrer un commentaire