开发者

How to increment field in sqlite android database

开发者 https://www.devze.com 2023-01-12 19:30 出处:网络
I want to increment a column in a sqlite android database. Im doing like this: public void atualiza(String word){

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

精彩评论

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