I am building an app on Android. And what I am trying to do is add 1 to the previous value in the database.
The value of the column score is 200 in the database.
SQLiteDatabase db = database.getWritableDatabase();
int resultRows = 0;
values = new ContentValues(1);
values.put(DBContract.Countries.SCORE, DBContract.Countries.SCORE + " + 1");
resultRows = db.update(DBContract.Countries.TABLE_NAME, values, DBContract.Countries.ISO + " = ?", selectionArgs);
The actual output is SCORE + 1 instead of 201. So it is taking it as a String instead of adding it. Does anyone have any ideas?
Aucun commentaire:
Enregistrer un commentaire