[EMAIL PROTECTED] wrote: > hi > i use odbc to update a table in a database but i always get return > value of -1 > even though i tried to return an integer. the table is updated though > ... > sql = """ > update table > set column = 0 > where col = "%s" > select @@rowcount > > """ % (var1) > .... > try: > s = odbc.odbc(connectstring) > cur = s.cursor() > res = cur.execute(sql) > s.commit() > s.close() > cur.close() > s = None > cur = None > print res > return res > except: > print 'error while processing ', sys.exc_type,sys.exc_value > > > how to properly get a positive return ? > thanks > Is the table actually being updated?
The definition of the cursor.execute() method in http://www.python.org/peps/pep-0249.html specifically says "Return values are not defined". So if you are seeing the database do the right thing I'd stop worrying about the return value. If exceptions aren't being raised and the database is doing what you want, what's the problem? regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list