androidsqlite更新语句
我正在尝试更新单行中的单个属性。然而,我下面的代码正在用“newdescription”值更新每一行androidsqlite更新语句,android,sqlite,sql-update,Android,Sqlite,Sql Update,我正在尝试更新单行中的单个属性。然而,我下面的代码正在用“newdescription”值更新每一行 public void editSingleLocation(String id, String new_description){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues newValues = new ContentValues(); newValues.p
public void editSingleLocation(String id, String new_description){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues newValues = new ContentValues();
newValues.put(COLUMN_DESCRIPTION, new_description);
db.update(TABLE_LOCATIONS, newValues, KEY_ID=id, null);
我试图使用这个链接中的一个解决方案
但它似乎不起作用。修复了它:
问题在于“KEY_ID=ID”;需要将其更改为:
db.update(TABLE_LOCATIONS, newValues, KEY_ID+"="+id, null);
对不起,我的错。它看起来像是属于问题的信息(在编辑之前更是如此)。