dimanche 28 juin 2015

Sqlite parameter substitution: "OperationalError: near "(": syntax error" [duplicate]

This question already has an answer here:

This code works for me until i put another parameter substitution in, specifically the one after "SET". Is there something simple im missing here? Any help or advice would be great!

for i, item in enumerate(items[0]):
    print item,number_sold[0][i],date
    c.execute("UPDATE stock SET (?) = (?) WHERE date IN (?)",[item,number_sold[0][i],date])
    c.commit()

The error:

 ---> 51         c.execute("UPDATE stock SET (?) = (?) WHERE date IN   (?)",[item,number[0][i],date])
 52         c.commit()

OperationalError: near "(": syntax error

printing "item,number[0][i],date" gives me "Cake, 3, 735719.0" which is what I expect.

Aucun commentaire:

Enregistrer un commentaire