2012-02-21 64 views
4

我有一个更新查询,我需要传递多个参数。请指导如何做。在这里代替“ID”我想要多个参数,例如名字年龄。Android SQlite更新查询

//代码

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

回答

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"}); 
+0

我想你摆错位置'}' – ariefbayu 2012-02-21 06:54:29

+0

@silent后期编辑。谢谢。 – user936414 2012-02-21 06:57:19