简体   繁体   English

我的基础 SQLITE3 有问题,如何解决?

[英]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 tryid=之后应该有 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.

相关问题 python sqlite3,我多久要提交一次? - python sqlite3, how often do I have to commit? 使用 sqlite3 和 tkinter 我做了这个小型库存管理系统,问题是数据库的条目总是 null - Using sqlite3 and tkinter i have made this small inventory management system, the problem is the entry to the database is always null Python中的SQLite3问题 - SQLite3 problem in Python Python SQLite3问题? - Python SQLite3 Problem with? 如何在Python中更新sqlite3数据时解决错误? - How to solve error while updating sqlite3 data in Python? 如何将数据写入从Python中的SQL数据库获取的文件中? (sqlite3的) - How do I write data to a file that I have taken from an SQL database in Python? (sqlite3) sqlite3 损坏时如何修复 Mac base conda 环境 - How to fix a Mac base conda environment when sqlite3 is broken python sqlite3 我有一个数据库如何获取主键输入然后获取数据库中另一个键的值 - python sqlite3 i have a database how to take prim key input and then take value of anther key in database 如何在 sqlite3 数据库中保存我在 tkinter canvas 中制作的绘图,然后再次在 canvas 中获取它 - how to save a drawing which i have made in tkinter canvas IN sqlite3 database and then again fetch it on canvas 你能帮我解决 Python Sqlite3 的问题吗? - Can you help me to solve problem from Python Sqlite3 with variable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM