How do you update a row using multiple search parameters in android?
Suppose I have an android sqlite table as follows:
Students
courseID name enrolled final_year
1 Adam yes no
2 Bob 开发者_开发问答yes no
2 Brian no yes
5 Brian no yes
6 Claire yes no
Now say I want to update the table as follows.
UPDATE Students
SET enrolled='yes'
WHERE courseID=2 and final_year='yes;
What is the best way of doing this in android?
ContentValues updateContent = new ContentValues();
updateContent.put("enrolled" , "yes");
db.update("Students" , updateContents, "courseID = ? and final_year = ?" , new String[] {"2" , "yes"});
精彩评论