Increase the value of a record in android/sqlite database

Viewed 9598

I try to increase the value of an integer key in a row in my table. However, nothing really seems to happen.

db.rawQuery("UPDATE table SET key = key + 1 WHERE name=?", new String[] {name});

However, this code works fine (just sets the key to a hard-coded value):

    ContentValues values = new ContentValues();
    values.put("key", 2);
    db.update("table", values, "name=?", new String[] {name});

Also tried '?' instead of just ?, but it resulted just in a run-time error.

1 Answers
Related