I know it's been asked a million times but I still cannot get it to work. I'm trying to delete a row from my sqlite database but I keep getting an error. I'm sure it's to do with my syntax but I cannot get the correct syntax.
heres my delete method
public void deleteRouteNote(int notePosition){
SQLiteDatabase db = getWritableDatabase();
db.delete(TABLE_ROUTE_NOTE, COLUMN_NOTE + COLUMN_ROUTE_NOTE_POSITION + "where" + COLUMN_ROUTE_NOTE_POSITION + "=" + notePosition, null);
db.close();
and the error I'm getting
android.database.sqlite.SQLiteException: no such column: routeNotewhererouteNotePosition (code 1): , while compiling: DELETE FROM route_note WHERE routeNotewhererouteNotePosition=9
thanks for any help!!
EDIT:
Heres how I insert the data
/////Add route note row to table
public void addRouteNote(RouteNote routeNote){
ContentValues values = new ContentValues();
values.put(COLUMN_NOTE, routeNote.get_routeNote());
values.put(COLUMN_ROUTE_NOTE_POSITION, routeNote.get_routeNotePosition());
SQLiteDatabase db = getWritableDatabase();
db.insertWithOnConflict(TABLE_ROUTE_NOTE , null, values, SQLiteDatabase.CONFLICT_REPLACE);
db.close();
}
Try this
db.delete(TABLE_ROUTE_NOTE, COLUMN_ROUTE_NOTE_POSITION + " = " + notePosition, null)