4

i have an update query where i need to pass multiple parameter. Please guide how to do. Here in place of "id" i want multiple parameters for example name age.

//Code

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

1 Answer 1

16

Try

   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"});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.