[英]I have a problem with the base SQLITE3, how to solve it?
I have such a code Python:我有这样的代码 Python:
conn.execute(("UPDATE instagram SET description_photo =? WHERE id="),self.inputDescriptionInstagram,self.idPhoto)
an error pops up: conn.execute(("UPDATE instagram SET description_photo =? WHERE id=?"),self.inputDescriptionInstagram,self.idPhoto) TypeError: function takes at most 2 arguments (3 given)一个错误弹出: conn.execute(("UPDATE instagram SET description_photo =? WHERE id=?"),self.inputDescriptionInstagram,self.idPhoto) TypeError: 函数最多接受 2 个参数(给出 3 个)
what am I doing wrong, where is the mistake?我做错了什么,错误在哪里?
self.inputDescriptionInstagram,self.idPhoto to the data transferred using the to definition button. self.inputDescriptionInstagram,self.idPhoto 到使用 to 定义按钮传输的数据。 All code is located in the class.所有代码都位于类中。
You also missed '?'你也错过了“?” after id=
There should be 2 arguments, 1st sql query , 2nd the parameters I think you should try在id=
之后应该有 2 个参数,第一个 sql 查询,第二个我认为你应该尝试的参数
conn.execute("UPDATE instagram SET description_photo =? WHERE id=?", (self.inputDescriptionInstagram,self.idPhoto))
or you can also do like this或者你也可以这样做
conn.execute("UPDATE instagram SET description_photo =" + self.inputDescriptionInstagram + " WHERE id= " + self.idPhoto+ )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.