开发者

How to increment field in sqlite android database

I want to increment a column in a sqlite android database. Im doing like this:

public void atualiza(String word){
   this.db.rawQuery("UPDATE words SET count = count + 1 WHERE word= ? ", new String[] {word});     开发者_JAVA百科
}

And I call this method on another class like this:

this.dh.atualiza(word); 

But when i pull the database from the emulator and check with the SQLite Database Browser, the field is not incremented. Why?


You should really use execSQL for a query that does not return a table: Increase the value of a record in android/sqlite database


You need to start a transaction on the database Data not inserting in Sqlite database in android

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜