vendredi 5 juin 2015

Why updating to Integer field with 0 in Android SQLite isn't working?

If i update my field to any number (1,2,3,4) it works, but if i do to 0 it doesn't, it just works if a put quotes. e.g. "0"

My code is:

 public int updateDatabaseConfig(ContentValues values){
            SQLiteDatabase db= this.getWritableDatabase();
            String selection = CONFIG_ID + "=" + 1;
            int rowAffected= db.update(configTable, values, selection, null);
            return rowAffected;
        }

It work with other numbers (1,2,3,5,8, etc) or with "0" but not just without quotes 0. The value in the database is set to INTEGER

values.put(DataBaseHelper.CONFIG_OFFLINE_MODE, 0);
int updatedConfig= dbHelper.updateDatabaseConfig(values);

Aucun commentaire:

Enregistrer un commentaire