0

What is the effective way to update all records in the database. I try to update all rows for the same key independent from table id, like this:

 for (int i = 0 ; i < rowsCount ; i++) {
      cv.put(column2, columnValue[i]);
      cv.put(column3, columnValue[i]);
      db.update(tableName, cv, null, null);
}

Update: I can't know the id values. The id values in the database looks like this: 1, 22, 50, 67 etc.

Sam Joos
  • 430
  • 2
  • 11
  • 25

1 Answers1

0

Updated:

String strSQL = "";

//Get the id that u want
String strSQL = "UPDATE theTable SET Column1 = someNewValue; UPDATE theTable SET Column1 = someNewValue;";
myDataBase.execSQL(strSQL);

Use ";" separator for each update that u want to introduce.

Alberto
  • 1,423
  • 18
  • 32