How to update a record with multiple keys
- by OceanBlue
I am trying a database app on Android.
I want to use the SQLiteDatabase update(...) convenience method to update a record.
Normally, for a WHERE clause of a single key this is working. Following code is working fine:-
values.put("testname", "Quiz1");
mDB.update("Tests", values, "id=?", new String[]{"2"}); //this statement works
However, I want to update a column in a table which has a combination of two keys as the unique identifier. I tried the following. This executes without exception, but nothing is updated.
values.put("score", 60);
mDB.update("Results", values, "studentid=? AND testid=?",
new String[] { "2,1" }); // this statement does not work
How to do it?