Search code examples
androiddatabasedelete-row

In Android how to delete the entire record in Table without passing any arguments?


Hai i created a DataBase and inserted the value in one Class,and i try to delete the record in another class but,the Whole table is Deleted.i need to delete the entire record only without deleteing the table.is it possible to delete all record without any condition? kindly help me Thanks in advance

public void deletePayment()
{

    db.delete(DATABASE_TABLE3, "KEY_ROLLID=?",null);//i want to delete all row in KEY_ROLLID
}

Solution

  • You doesn't try DELETE Statement,

    In android you can execute Sql Query with db.rawQuery also, in this you can pass Delete Statement for your table, as:

    db.rawQuery("Delete FROM Table_Name");