mx.ODBC execute() error 07001 with MsAccess

pu pu at
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\", line 83, in ?
  File "I:\My Programs\Python\", line 34, in __init__
    c2.execute(sqlcmd, (maxnow, maxnow2))
mxODBC.ProgrammingError: ('07001', -3010, '[Microsoft][ODBC Microsoft Access
ver] Too few parameters. Expected 3.', 4573)

Any ideas?

More information about the Python-list mailing list