【发布时间】:2011-08-25 18:28:49
【问题描述】:
我想更新我的 SQLite 数据库中特定行的特定列中的值。我应该进行哪种类型的 SQLite 调用?我可以使用 rawQuery() 来执行此操作,还是应该使用 update() 方法。对这些有什么要求?
我现在拥有的是这个:
ContentValues values = new ContentValues();
values.put("c_uploaded", "true");
String where = new String("WHERE c_created_at = ?");
String[] created = new String[] {"Tuesday"};
db.update("TABLE", values, where , created);
所以我想将 c_uploaded 列更新为 true,其中 c_created 列是 tuesday
这样做有意义还是有更好的方法?
感谢您的帮助。
【问题讨论】:
-
使用ORMAN framework,这很容易。您只需更改字段,然后说
yourObject.update()。
标签: android database sqlite sql-update