chris wrote:
...
This works fine using the literals 0 (For Delstatus) and 1190 (for ProductID) But when I try to use a variable such as:
################################################################### ... varA = '0' varB = '1190' mycursor.execute('Update Categories Set DelStatus = ' varA 'Where ProductID = ' varB)
use string formatting expressions (which are easier to handle than string concatenation) :
'UPDATE Categories SET DelStatus=%d WHERE ProductID=%s;' % (varA,'1190')
or maybe
"UPDATE Categories SET DelStatus='%d' WHERE ProductID='%d';" % (0,varB)
if your DB wants your int's as string
###################################################################
I get errors. Please excuse my ignorance in what is probably obvious to most others within this newsgroup..... What I am trying to do is to update my database from a 2 field .CSV file I figured I could load the CSV file into a dictionary and parse each row running a query using the values from varA and VarB from the key value pairs.
happy pythoning
Herbert -- http://mail.python.org/mailman/listinfo/python-list