Android SQLite: Update Statement

后端 未结 6 2004
半阙折子戏
半阙折子戏 2020-11-28 02:02

I need to implement SQLite in my application. I followed this tutorial.. Creating and using databases in Android one

Everything is working fine. I inserted 1 row wit

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 02:55

    It's all in the tutorial how to do that:

        ContentValues args = new ContentValues();
        args.put(columnName, newValue);
        db.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null);
    

    Use ContentValues to set the updated columns and than the update() method in which you have to specifiy, the table and a criteria to only update the rows you want to update.

提交回复
热议问题