python - PYODBC ProgrammingError : ('42000' , “[42000] [Microsoft][Pilote ODBC Microsoft Access]

标签 python ms-access pyodbc

我尝试在另一个 mdb 上使用左连接进行更新查询。

进入第一个 MDB 的游标,我执行此查询:

update table as ori 
    left join (select * 
               from param in "E:/Jeter/param_141114.mdb" 
               where zone = '1H005') param 
    on ori.dep_sur = param.dsu_co 
set ori.texture = param.textu where mid(ori.type,4,1) in ('0','7','8')

当我从 Microsoft Access 启动此查询时,没问题,查询已应用。

当我使用 pyodbc 从 python 2.7 启动这个查询时,这里我的结果是从法语翻译过来的:

ProgrammingError ('42000', "[42000] [Microsoft] [ODBC Microsoft Access Driver] The database engine can not find [E: /Jeter/param_141114.mdb] 'Make sure the name. parameter or alias is valid, he does not understand character or incorrect punctuation and that it is not too long. (-1002) (SQLExecDirectW) ")

一些想法?

最佳答案

显然 SELECT ... FROM TableName IN "FileName"... 语法不适用于来自外部应用程序的 ODBC 查询。但是,我只是尝试了以下变体并且它对我有用(Python 2.7 和 pyodbc):

sql = """
update tableau as ori 
    left join (select * 
               from [C:/__tmp/test.mdb].param 
               where zone = '1H005') param 
    on ori.dep_sur = param.dsu_co 
set ori.texture = param.textu
"""
crsr = db.execute(sql)
crsr.commit()

关于python - PYODBC ProgrammingError : ('42000' , “[42000] [Microsoft][Pilote ODBC Microsoft Access],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26938930/

相关文章:

python - Firefox 中的 iPython Notebook - 警告 : unresponsive script

python - "Heat map"平均值

python - 如何在 requirements.txt 中允许未经验证的包

c# - "Data source name not found and no default driver specified"用于创建 Access 连接

python - 无法使用 pyodbc 执行带有参数的类似查询

python - 使用 PYODBC 将 BitTorrent 位字段插入 MSSQL 中的 VarBinary(MAX)

python - 在六边形网格上寻找相邻的邻居

java - java程序中连接 Access 数据库

c# - 'Microsoft.ACE.OLEDB.12.0' 驱动程序可以作为 dll 发送给客户端吗?

python - pyodbc 没有更新表