lundi 23 mars 2015

Deleting row from Sqlite in Python does not work

I've got this function however deleting from db does not work for some reason. Anyone any guesses please? Thanks a lot in advance.


self.connect = sqlite3.connect("data.sqlite") self.cur = self.connect.cursor() self.cur.execute("CREATE TABLE IF NOT EXISTS data(products TEXT, suppliers TEXT)") self.connect.commit() list = self.cur.execute("SELECT * FROM data")


...


def delete(self): productx = str(self.listbox.get(ACTIVE))[3:-3] self.cur.execute("DELETE FROM data WHERE Products=?",(productx,)) self.connect.commit()


Aucun commentaire:

Enregistrer un commentaire