开发者

SQLite problem deleting element from table

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜