mercredi 5 août 2015

Delete specific record in sqlite table based on two criteria: _id and column

I have created a sqlite table for my android app, this table has 5 columns and multiple rows, the columns being: _id, column1, column2, column3, column4.

I want to delete a specific record, for instance the record stored in column3 corresponding to _id (in a different class are the getters and setters, for this I've named the class "TableHandler")

I guess that I'm a bit confused, following is what I was planning, but for column3 I'm not sure what should be the argument, I just want to delete whatever is in that column position corresponding to _id

 public void deleteValueColumn3(TableHandler value){
        SQLiteDatabase db = this.getWritableDatabase();
        db.delete(TABLE_NAME, KEY_ID + " = ? AND " + KEY_COLUMN3 + " = ?",
                new String[] {String.valueOf(value.getID()), ?????????);
        db.close();

    }

The ???????? is that I'm stuck there, maybe the whole method needs to be rewritten, I would appreciate your input.

Thanks

Aucun commentaire:

Enregistrer un commentaire