0
每当我尝试运行下面的代码,我得到一个错误,说theres没有这样的列“title_data”,我真的很困惑,因为“标题”是不是“title_data”列如何插入变量到数据库表sqlite3 - 蟒蛇
def insertData(self):
title_Data = self.edit_title.text()
year_Data = self.edit_year.text()
rating_Data = self.edit_rating.text()
connection = sqlite3.connect('films.db')
try:
connection.execute("INSERT INTO FILMS (TITLE,YEAR,RATING) VALUES(title_Data,year_Data,rating_Data)")
except sqlite3.IntegrityError:
print("You have already stored this data")
connection.commit()
connection.close()
非常感谢,即时通讯相对较新的sqlite3谢谢。 – Noob
@Noob没关系!如果这对您有帮助,您可以将其标记为答案并/或使用其左侧的按钮进行表决。 – asongtoruin
你能帮我解决一件事吗? – Noob