[Tutor] Problems with parameter queries

Eduardo Vieira eduardo.susan at gmail.com
Wed Jun 24 21:30:58 CEST 2009


Hello, I am accessing a Pervasive SQL data source using odbc and I'm
having this trouble:

import dbi
import odbc
 # the first execute works
pnumber = '09F153'
wh = '00'
qty = 3
myconn = odbc.odbc('DSN=MKPT01')
mycursor = myconn.cursor()
mycursor.execute("""
SELECT "INVENTORY"."CODE", "INVENTORY"."INV_DESCRIPTION" FROM "INVENTORY"
WHERE "INVENTORY"."CODE" = ? AND WHSE = ?

""", [pnumber, wh])
results = mycursor.fetchall()

print results

# this one below doesn't

mycursor.execute("""UPDATE INVENTORY SET ONHAND = ?
WHERE CODE = ? AND WHSE = '00'

""", [pnumber, qty])
#mycursor.commit()
mycursor.close()

If I don't use parameter in the update code, it updates fine. Am I
missing something? Is this a problem specific to the Pervasive SQL?
For example, this works:
mycursor.execute("""UPDATE INVENTORY SET ONHAND='0'
WHERE CODE = '09F153' AND WHSE = '00'

""")

Thanks

Eduardo


More information about the Tutor mailing list