public int updateParticipant(Participant participant) { // 1. get reference to writable DB SQLiteDatabase db = this.getWritableDatabase(); // 2. create ContentValues to add key "column"/value ContentValues values = new ContentValues(); // get nom values.put(PARTICIPANT_NOM, participant.getNom()); // get prenom values.put(PARTICIPANT_PRENOM, participant.getPrenom()); // 3. updating row int i = db.update( TABLE_PARTICIPANT, values, PARTICIPANT_ID + " = ?", new String[] {String.valueOf(participant.getId())}); // 4. close db.close(); return i; }
public void delateParticipant(Participant p) { // 1. get reference to writable DB SQLiteDatabase db = this.getWritableDatabase(); // 2. delete db.delete(TABLE_PARTICIPANT, PARTICIPANT_ID + " = ?", new String[] {String.valueOf(p.getId())}); // 3. close db.close(); }