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
You could also use:
curs.execute('UPDATE Categories SET DelStatus=? WHERE ProductID=?;', (varA, 1190))
Uwe
-- http://mail.python.org/mailman/listinfo/python-list