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