samedi 18 juillet 2015

UPDATE query with IN clause in ANDROID sqlite

I want to set a new value to multiple rows in sqlite database in my android application. For updating multiple rows I am using IN clause. But the query doesn't work. I have tried multiple ways but result is it is not updating the new value.

Code 1

ContentValues values1 = new ContentValues();
values1.put("column_name", "2");
sqLiteDatabase.update("table_name", values1, "pkId IN ?", new String[]{"11, 12, 13, 14, 17, 20, 112, 115, 118, 121, 123"});

Code 2

ContentValues values1 = new ContentValues();
values1.put("column_name", "2");
sqLiteDatabase.update("table_name", values1, "pkId IN (?)", new String[]{"11, 12, 13, 14, 17, 20, 112, 115, 118, 121, 123"});

Aucun commentaire:

Enregistrer un commentaire