获取sqlite3.OperationalError:不完全输入

jaql4c8m  于 2023-05-29  发布在  SQLite
关注(0)|答案(1)|浏览(146)
c.execute("SELECT * FROM addresses WHERE oid = " + record_id)
c.execute("DELETE from addresses WHERE oid = " + delete_box.get)

这是显示错误的两行,我在stackoverflow上读到了一个答案,但是错误没有得到纠正。

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Nampoothiri\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1884, in __call__
    return self.func(*args)
  File "C:\Users\Nampoothiri\OneDrive\Desktop\College\Python\EXPERIMENT 6\TKINTER.py", line 153, in delete
    c.execute("DELETE from addresses WHERE oid = " + delete_box.get())
sqlite3.OperationalError: incomplete input
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Nampoothiri\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1884, in __call__
    return self.func(*args)
  File "C:\Users\Nampoothiri\OneDrive\Desktop\College\Python\EXPERIMENT 6\TKINTER.py", line 89, in edit
    c.execute("SELECT * FROM addresses WHERE oid = " + record_id);
sqlite3.OperationalError: incomplete input

这些都是不断出现的错误。

k97glaaz

k97glaaz1#

在您的问题中,错误是遇到有关不完整的输入错误.有很多方法可以避免这个错误。如果你把它存储到变量中,那么还有另一种方法。但是如果你是通过get函数获取数据,那么你可以尝试.....

c.execute("DELETE FROM addresses WHERE oid = ?", (delete_box.get(),))

相关问题