Python GUI TKINTER SQLITE3以下代码的错误



CODE:-

def datasave():
conn = sqlite3.connect('lpugym.db')
c = conn.cursor()
c.executemany('INSERT INTO lpugym(name,phone) VALUES (?,?),(name.get(), phone.get();')
c.execute('INSERT INTO lpugym ((phone) VALUES (phone.get())')
if var.get()==1 :
c.execute('INSERT INTO lpugym ((gender) VALUES (Male)')
else:
c.execute('INSERT INTO lpugym ((gender) VALUES (Female)')
if var2.get()==1 :
c.execute('INSERT INTO lpugym ((package) VALUES (Monthly)')
if var2.get()==2 :
c.execute('INSERT INTO lpugym ((package) VALUES (Yearly)')
global price
if var2.get()==1 :
price=2500*var1.get()
c.execute('INSERT INTO lpugym ((price) VALUES (price)')
if var2.get()==2 :
price=2450*var1.get()*12
c.execute('INSERT INTO lpugym ((price) VALUES (price)')
c.execute('INSERT INTO lpugym ((address) VALUES (address.get())')
c.commit()
c.close()
conn.close()

输出

Tkinter 回调中的异常 回溯(最近一次调用(: 文件行 1702,在呼叫return self.func(*args)文件"S:可编辑.py",第 105 行,在数据保存中c.executemany('INSERT INTO lpugym(name,phone,gender,package,price,address) VALUES (?,?),(name.get(), phone.get();')类型错误:函数正好需要 2 个参数(给定 1 个(

.executemany语句中phone.get()末尾添加另一个括号。

c.executemany('INSERT INTO lpugym(name,phone) VALUES (?,?), (name.get(), phone.get()))

最新更新