Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中使用WHERE子句仅为一列更新Sqlite数据库_Android_Database_Sqlite_Android Intent - Fatal编程技术网

如何在android中使用WHERE子句仅为一列更新Sqlite数据库

如何在android中使用WHERE子句仅为一列更新Sqlite数据库,android,database,sqlite,android-intent,Android,Database,Sqlite,Android Intent,可能重复: 是否可以使用where语句更新一列的数据库 这是我的表结构,我需要使用“id”更新“messagestatus”列 我尝试过这个,但没有成功,有一个警告“没有这样的专栏发送” 提前感谢。字符串值必须用引号括起来: "UPDATE autosms SET messagestatus='"+s+"' WHERE id="+id+"" 我在这里添加了一个引号“+s+” 如果没有它,字符串将如何展开: "UPDATE autosms SET messagestatus=Send WHER

可能重复:

是否可以使用where语句更新一列的数据库 这是我的表结构,我需要使用“id”更新“messagestatus”列

我尝试过这个,但没有成功,有一个警告“没有这样的专栏发送”


提前感谢。

字符串值必须用引号括起来:

"UPDATE autosms SET messagestatus='"+s+"' WHERE id="+id+""
我在这里添加了一个引号
“+s+”

如果没有它,字符串将如何展开:

"UPDATE autosms SET messagestatus=Send WHERE id=1234
SQLite将尝试查找名为Send的列,并将messagestatus设置为其值。

从方法上的文档:

执行一条不是SELECT/INSERT/UPDATE/DELETE的SQL语句


你应该改用这个方法,因为我无法理解你。你能解释一下吗?我需要用id更新messagestatus,但我不能。。。怎么做?这是我的问题,我无法更新。。谢谢。可以只更新一个栏目吗?谢谢Simon。让我看看这个…是的,明白了。。。很好用。。谢谢……不客气。请记住接受答案。谢谢
"UPDATE autosms SET messagestatus='"+s+"' WHERE id="+id+""
"UPDATE autosms SET messagestatus=Send WHERE id=1234