for some reason I can't delete a row of my table, this is my simple database:
create table party(_id intege开发者_如何学Gor primary key autoincrement, dateID text not null, partyName text not null, eventDate text not null, eventID text not null)
and I wrote a method to delete a party knowing the dateID
public boolean deletePartyFromDateId(String dateID)
{
boolean result = db.delete(DATABASE_TABLE, KEY_DATEID + "=" + dateID, null) > 0;
return result;
}
I also wrote a simple method to delete all the elements, and this works fine
public boolean deleteAll()
{
boolean result = db.delete(DATABASE_TABLE, null, null) > 0;
return result;
}
Thank you very much! :)
i think you shoud try this
boolean result = db.delete(DATABASE_TABLE, KEY_DATEID + "='" + dateID+"'", null) > 0;
boolean result = db.delete(DATABASE_TABLE, KEY_DATEID + "=?", new String[]{dateID}) > 0;
return result;
try this.
精彩评论