K
Khalid Al-Ghamdi
Is there a way to create a func that returns a cursor that can be used to execute sql statements?
I tried this (after importing sqlite3), but it gave me the error below:
conn = sqlite3.connect(':memory:')#use sch3.db or sch4.db .... etc.
cur = conn.cursor()
cur.execute("create table schedule (teams integer, sn integer, badge integer ,name text, grp integer,\
major text, track text, stage text, tc text, subject text, course text, ws text, date text, \
time text, proctor text, code text, no integer,fl_time text, flag2 text, flag3 text, flag4 text, clash1 integer, clash2 integer)")
return curTraceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
cur.execute("select * from schedule")
NameError: name 'cur' is not defined
I tried this (after importing sqlite3), but it gave me the error below:
conn = sqlite3.connect(':memory:')#use sch3.db or sch4.db .... etc.
cur = conn.cursor()
cur.execute("create table schedule (teams integer, sn integer, badge integer ,name text, grp integer,\
major text, track text, stage text, tc text, subject text, course text, ws text, date text, \
time text, proctor text, code text, no integer,fl_time text, flag2 text, flag3 text, flag4 text, clash1 integer, clash2 integer)")
return curTraceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
cur.execute("select * from schedule")
NameError: name 'cur' is not defined