mx.ODBC execute() error 07001 with MsAccess

nikolai.kirsebom.NOJUNK at siemens.no nikolai.kirsebom.NOJUNK at siemens.no
Mon Oct 21 14:38:34 CEST 2002


Works ok on my machine (SQL Server 2000).  However, should the text be
enclosed in single quotes (') and not in double quotes (").  At least
on SQL Server enclosing in double quotes produces an error.

Nikolai

On Sun, 20 Oct 2002 19:25:56 +0200, "pu" <pu at myRealBox.com> wrote:

>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