dimanche 5 juillet 2015

how to use of update operation sqlite?

I have problem with my sqlite update operation, please help me how to fix it that is my database handler for update data :

public int updateAccountCalc(Accounts accounts) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(KEY_ID, accounts.getId());
        values.put(KEY_NAMA, accounts.getNama());
        values.put(KEY_EMAIL, accounts.getEmail());
        values.put(KEY_BB0, accounts.getBB0());
        values.put(KEY_BB1, accounts.getBB1());
        values.put(KEY_BB2, accounts.getBB2());
        values.put(KEY_BB3, accounts.getBB3());
        values.put(KEY_LILA, accounts.getLila());

        // updating row
        return db.update(TABLE_NAME, values, KEY_ID + " = ?",
                new String[] { String.valueOf(accounts.getId()) });
    }

and this is code to use it :

db.updateAccountCalc(new Accounts(0, nama.toString(), email.toString(), bb, 0, 0, 0, lila));

i have inserted value of bb, but is never updated on sqlite database

Aucun commentaire:

Enregistrer un commentaire