安卓SQLite更新查询

4
我有一个更新查询,需要传递多个参数。请指导如何操作。这里我想用多个参数替换“id”,例如姓名和年龄。
// 代码
   ContentValues updateCountry = new ContentValues();
   updateCountry.put("country_name", "United States");
   db.update("tbl_countries", updateCountry, "id=?", new String[] {Long.toString(countryId)})
1个回答

16

请尝试

   ContentValues updateCountry = new ContentValues();
   updateCountry.put("country_name", "United States");
   db.update("tbl_countries", updateCountry, "id=? AND name=? AND age=?", new String[]{Long.toString(countryId),"name_value","age_value"});

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接