gpt4 book ai didi

java - 如何在android中使用多个搜索参数更新一行?

转载 作者:行者123 更新时间:2023-12-01 19:15:07 24 4
gpt4 key购买 nike

假设我有一个 android sqlite 表如下:

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

现在假设我要按如下方式更新表格。

UPDATE Students 
SET enrolled='yes'
WHERE courseID=2 and final_year='yes;

在 Android 中执行此操作的最佳方法是什么?

最佳答案

ContentValues updateContent = new ContentValues();
updateContent.put("enrolled" , "yes");
db.update("Students" , updateContents, "courseID = ? and final_year = ?" , new String[] {"2" , "yes"});

关于java - 如何在android中使用多个搜索参数更新一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7053418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com