Sunday, 8 September 2013

Issue deleting row from database

Issue deleting row from database

So this seems pretty simple but I haven't been able to figure out what I'm
doing wrong here. I have my database delete command:
public boolean deleteContact(String rowId) {
return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
}
I also should mention that I am displaying the database in a listview. So
when the user clicks on an item they are presented with a "OK" and a
"Delete" option.
When they hit delete this is the command I'm using:
db.open();
db.deleteContact("Apple Recipe");
db.close();
dialog.dismiss();
I keep getting a force close issue that says:
android.database.sqlite.SQLiteException: ner "Recipe":syntax error
(code 1): , while compiling: DELETE FROM list WHERE item=Apple Recipe
I'm probably doing something stupid so maybe fresh eyes will help.

No comments:

Post a Comment