mx.ODBC execute() error 07001 with MsAccess

pu pu at myRealBox.com
Sun Oct 20 19:25:56 CEST 2002


Hi all,
I am a newcomer to Python and ODBC and I have the following code that
misbehaves with mx.ODBC and an MS-ACCESS database:

        db = mxODBC.connect(DBname)
        c2 = db.cursor()
        sqlcmd = "select count(*) from %s where (%s > ? and %s <= ?) and
(%s)" % (TBname,TBcol,TBcol,condit)
        print now()," ...",sqlcmd
        c2.execute(sqlcmd, (maxnow, maxnow2))

at the execute, I get the following message:

2002/10/20 18:17:59  ... select count(*) from testtb where (key > ? and key
<= ?
) and (text="stop")
Traceback (most recent call last):
  File "I:\My Programs\Python\DBListener.py", line 83, in ?
    db=DBListener(waittime,DBname,TBname,keyCol,condit)
  File "I:\My Programs\Python\DBListener.py", line 34, in __init__
    c2.execute(sqlcmd, (maxnow, maxnow2))
mxODBC.ProgrammingError: ('07001', -3010, '[Microsoft][ODBC Microsoft Access
Dri
ver] Too few parameters. Expected 3.', 4573)

Any ideas?





More information about the Python-list mailing list