Reputation: 26
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()
Output
Exception in Tkinter callback
Traceback (most recent call last):
File line 1702, in call
return self.func(*args)
File "S:editable.py", line 105, in datasave
c.executemany('INSERT INTO lpugym(name,phone,gender,package,price,address) VALUES (?,?),(name.get(), phone.get();')
TypeError: function takes exactly 2 arguments (1 given)
Upvotes: 0
Views: 96
Reputation: 106
Add another bracket to the end of the phone.get()
in the .executemany
statement.
c.executemany('INSERT INTO lpugym(name,phone) VALUES (?,?), (name.get(), phone.get()))
Upvotes: 1