my table contains 7 records. With the update method, I want to update a column that has INTEGER values . with a for loop, I want to update all records with a sequence of numbers, but it seems not work properly, because all records are updated with the last of the loop (7). Maybe the error is in the WHERE clause? Thanks for your advice.
SQLiteDatabase datab = new DatabaseHelper(getActivity()).getReadableDatabase();
ContentValues cv = new ContentValues();
for(int i = 1; i<8; i++){
cv.put(MyTable.NUMERAZIONE, i);
datab.update(MyTable.TABLE_NAME, cv, MyTable.NUMERAZIONE + "!="+i, null);
}
datab.close();
I also tried without a WHERE clause, but I get the same result:
datab.update(MyTable.TABLE_NAME, cv, null, null);
Records are 7, I want to update all records, without any clause.
Aucun commentaire:
Enregistrer un commentaire