Possible Duplicate:
Android Delete Query
I've db and right now it has 17 records. This is my code:
SQLiteDatabase db=openOrCreateDatabase("mydb", MODE_PRIVATE, null);
c= db.rawQuery("DELETE FROM tbl1 where cat='12'",null);
db.close();
It's a really simple query but every time I run the app on emulator, it's runs perfectly without any error but I doesn't remove anything either.
Could anyone helps me with what is the problem ?
db.execSQL("DELETE FROM tbl1 where cat=12");
try this
public void deleteContact(Contact contact) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_CONTACTS, KEY_ID + " = ?",
new String[] { String.valueOf(contact.getID()) });
db.close();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With