How to update a record with multiple keys

Posted by OceanBlue on Stack Overflow See other posts from Stack Overflow or by OceanBlue
Published on 2010-05-15T15:33:02Z Indexed on 2010/05/15 15:44 UTC
Read the original article Hit count: 181

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about android

Related posts about sql