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.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to