简体   繁体   中英

I have a problem with the base SQLITE3, how to solve it?

I have such a code 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)

what am I doing wrong, where is the mistake?

self.inputDescriptionInstagram,self.idPhoto to the data transferred using the to definition button. 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

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+ )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM