[Tutor] sqlite3 COMMIT directive
Alan Gauld
alan.gauld at btinternet.com
Tue Oct 1 10:11:35 CEST 2013
On 01/10/13 09:03, Alan Gauld wrote:
> BTW. I notice you are using an implicit cursor within the with block.
> Now while that may work, my personal preference is for explicit
> variables, ...
Actually I'm not sure how it is working. I've just read the docs again
and it seems to me that your code should be referencing 'con' not 'cur'.
That may be part of the problem...
>> con = sqlite3.connect(DataBase)
>> with con:
>> cur.execute("""INSERT INTO %s VALUES
>> (NULL, '%s', '%s', '%s', '%s', '%s', '%s');""" % \
>> (Table, self.first, self.last, self.partner,
>> self.address, self.phone, self.email, ) )
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list