vendredi 27 février 2015

How to delete the first 10 row from database SQlite in android?

I am building an android application where I am using data helper class to store the data.


Now the problem I am facing is How can I delete top old 100 data from table.


I am using below query but my app crush.



public void deleteRec() {
String ALTER_TBL ="delete from " + TBL_NAME +
" order by _id LIMIT 3);";
db.execSQL(ALTER_TBL);
}


And calling using - new DatabaseHelper(getApplicationContext()).deleteRec();


Aucun commentaire:

Enregistrer un commentaire