Can someone explain how the delete actually works, as the documentation isn’t providing me with enough help. What i’m trying to do is delete all rows from my table where the date matches the one i provide in the delete method.
This is what i’ve tried:
SQLiteDatabase db = appts.getWritableDatabase();
String whereclause = "WHERE DATE = ";
long seldate = calendar.getDate()/1000;
String datestodelete = new java.text.SimpleDateFormat("dd/MM/yyyy").format(new java.util.Date (seldate*1000));
db.delete(TABLE_NAME, whereclause, datestodelete);
But it says String String String isnt accepted for that method, what would i put in instead?
The third argument should be of type
String[], notString:Your
table,whereClause, andwhereArgsshould be formatted as follows:In other words, the values in the
String[]will replace the?s in yourwhereClause. Also note that you should omit theWHEREat the beginning of yourwhereClause(this will be added automatically when Android performs the delete).