how to return correct value of update stmt

eight02645999 at yahoo.com eight02645999 at yahoo.com
Tue Oct 18 20:06:25 EDT 2005


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




More information about the Python-list mailing list