Я работаю над базой данных mini, используя Tkinter и Sqlite. Для одной из моих функций я настроил обновление любого выбранного кортежа из списка. Я продолжаю получать сообщение об ошибке, и надеюсь, что кто-нибудь мне поможет.
Я просмотрел свой код, как в интерфейсе (GUI), так и в интерфейсе (SQLITE), и все же не могу понять, о чем идет речь. Я мог бы упустить что-то простое.
Back End (ошибка включена в код)
def update(Model, Serial, type, Test1, Test2, Test3, Test4, Duration, Failure, Comments):
'''cur.execute("UPDATE Ml SET Model="", Serial="", Type="", Test1="", Test2="", Test3="", Test4="", Duration="", Failure="", Comments="", where id=?" (Model, Serial, Type, Test1, Test2, Test3, Test4, Duration, Failure, Comments, id))
TypeError: 'str' object is not callable'''
conn = sqlite3.connect("Antenna.db")
cur = conn.cursor()
cur.execute("UPDATE Ml SET Model="", Serial="", Type="", Test1="", Test2="", Test3="", Test4="", Duration="", Failure="", Comments="", where id=?" (Model, Serial, Type, Test1, Test2, Test3, Test4, Duration, Failure, Comments, id))
conn.commit()
conn.close()
Front End
def update_command():
result = messagebox.askquestion("Edit Record?", "Are you sure you'd like to change the following record?")
if result == "yes" and model_text.get() and serial_text.get() and Type_text.get() and Test1_text.get() and Test2_text.get() and Test3_text.get() and Test4_text.get() and duration_text.get() and failure_text.get() and comment_text.get():
Back_End.update(model_text.get(), serial_text.get(), Type_text.get(), Test1_text.get(), Test2_text.get(), Test3_text.get(), Test4_text.get(), duration_text.get(), failure_text.get(), comment_text.get())
view_command()
else:
messagebox.showerror("Invalid Selection", "Please Select a item to edit")