Sqlite Delete Operation in Android Part – 7

 

What is Delete Operation? How to Delete data from SQLite DB? The Delete Operation is Used to delete the rows specified in ‘WHERE’ clause.
For deleting row from a table,we need to provide selection criteria that identify the rows
Example:
public void deleteContact(Contact contact) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_CONTACTS, KEY_ID + ” = ?”,
new String[] { String.valueOf(contact.getID()) });
db.close();
}


Leave a Reply

Your email address will not be published. Required fields are marked *