r2D*_*Inc 1 java sql database android
我有一个我需要更新的数据库条目.
这种方法显然不起作用,但它应该有助于解释我想要做什么.
public void updateEntry(String user, String message, String mentions, String og) {
ContentValues args = new ContentValues();
args.put(KEY_MESSAGE, message);
args.put(KEY_MENTIONS, mentions);
this.db.update(ENTRY_TABLE, args, ("message = ?", "username = "+user), new String[] {og});
}
Run Code Online (Sandbox Code Playgroud)
我需要更新"name"列和"message"列都匹配输入值的条目.
数据库具有多个具有相同用户的条目,并且可能具有多个具有相同消息但具有不同用户的条目,因此需要多个where子句.
如何在SQL查询中使用两个(或更多)where子句?
nge*_*esh 10
这个改变应该有效..
this.db.update(ENTRY_TABLE, args, ("message = ? AND username = "+user), new String[] {og});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7140 次 |
| 最近记录: |