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

+0

@silent編集​​したポスト。ありがとうございました。 – user936414