(oops... forgot to reply-all)
---------- Forwarded message ---------- From: Richard Lovely <roadier...@googlemail.com> Date: 2009/6/25 Subject: Re: [Tutor] Problems with parameter queries To: Eduardo Vieira <eduardo.su...@gmail.com> 2009/6/24 Eduardo Vieira <eduardo.su...@gmail.com>: > 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 > _______________________________________________ > Tutor maillist - tu...@python.org > http://mail.python.org/mailman/listinfo/tutor > Isn't the arguement list to the non-working query back-to-front? -- Richard "Roadie Rich" Lovely, part of the JNP|UK Famile www.theJNP.com -- Richard "Roadie Rich" Lovely, part of the JNP|UK Famile www.theJNP.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor