2012-02-21 1 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