开发者

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜