[Tutor] Didn't take long to hit my next wall!

John CORRY john.corry at ntlworld.com
Sat Apr 15 23:26:34 CEST 2006


Hi,
 
I am having problems amending records in my database.
 
If I use the following code my database is updated fine.
 
c = '"PF1"'
b = 91.4
a = 85.00
import mx.ODBC
import mx.ODBC.Windows
db = mx.ODBC.Windows.DriverConnect('DSN=vfp')
c = db.cursor()
c.execute('UPDATE cost_grid SET cost_1 = ? where cost_grid_id = "PF1"
and finish_dro = ?', ( a, b,))
   
db.commit()
c.close()
 
However if I use the following code:- 
Where the only difference is I use the c variable instead of the actual
"PF1".  The database does not get updated.  I have also tried 
C =  "PF1"  but this does not work either.
 
c = '"PF1"'
b = 91.4
a = 85.00
import mx.ODBC
import mx.ODBC.Windows
db = mx.ODBC.Windows.DriverConnect('DSN=vfp')
c = db.cursor()
c.execute('UPDATE cost_grid SET cost_1 = ? where cost_grid_id = ? and
finish_dro = ?', ( a, c,b,))
    
db.commit()
c.close() 
 
Any suggestions would be greatly appreciated.
 
Thanks,
 
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060415/d2ef578c/attachment.htm 


More information about the Tutor mailing list