Reputation: 81
import sqlite3
conn = sqlite3.connect('test3.db')
cursor = conn.cursor()
cursor.execute("""create table if not exists test(
num integer primary key autoincrement,
name char(5))""")
cursor.execute("insert into test(num, name) values(null, 'andy')")
conn.commit()
for i in cursor.execute("select *from test"):
if int(i[0]) <= 1:
conn.commit()
else:
conn.close()
I put the sqlite3 value in wx.combobox
, choices and have the changed value applied to sqlite3 when the wx.combobox
value is changed. I have a problem during operation and want to fix it.
When you run the program
cursor.execute ("insert into test (num, name) values (null, 'andy')")
This statement continues execution. How do I get my program to run once when I run it?
Upvotes: 0
Views: 37
Reputation: 64
From what I understand you do not need to pass the number in query as it is set to autoincrement.
Upvotes: 1