我在Python中遇到(sqlite3.OperationalError:输入不完整)错误

2024-09-30 03:23:20 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我使用的代码:

def edit():

    global editor
    editor = Toplevel()
    editor.title("Edit A Record")  
    editor.iconbitmap(r"C:\Users\StePHAnie\Desktop\Python course (learning python)\Tkinter full course in python\icon.ico")
    editor.geometry("360x550")

    conn = sqlite3.connect("address_book.db") 
    c = conn.cursor() 

    record_id = delete_box.get()                   
    c.execute("SELECT * FROM addresses WHERE oid = " + record_id)
    records = c.fetchall() 

这是我得到的一个错误:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\StePHAnie\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1884, in __call__
    return self.func(*args)
  File "c:\Users\StePHAnie\Desktop\Python course (learning python)\VScode\Tkinter\complenation_notes_tkinter_python3.py", line 463, in edit
    c.execute("SELECT * FROM addresses WHERE oid = " + record_id)  # and add here (WHERE oid = " + (the name of delete_box.get here it is record_id))
sqlite3.OperationalError: incomplete input

我试着尽我所能,但我想不出解决办法。 顺便说一下,我花了两天时间试图找到解决这个问题的办法

Go to this link to see a picture of the code with an error in the terminal

如果有人能帮我,请帮我


Tags: theinidtkinterrecordconnwhereedit

热门问题