[英]Accessing a MS Access database with Qt on Win7 X64
I used to have a Qt application which connected to a MS Access database (named JSpo2014.accbd
) using the following code : 我曾经有一个Qt应用程序,它使用以下代码连接到MS Access数据库(名为
JSpo2014.accbd
):
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("Driver={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DSN='';DBQ=C:\\2014\\bd\\JSpo2014.accdb");
db.open();
My Qt application is developed with Qt Creator, using Qt5.3.0 for MinGW x86. 我的Qt应用程序是使用Qt5.3.0 for MinGW x86与Qt Creator开发的。
It used to work fine on these configs : 它过去在这些配置上运行良好:
But it is not working on any of these configs : 但它不适用于以下任何配置:
I get he following error message : 我得到他以下错误消息:
"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
"QODBC3: Unable to connect"
How can I make it work on Win7x64 with Office installed ? 如何在安装了Office的Win7x64上运行它?
You seem to need a 64 bit driver as you shown everything works on your Windows running in a 32 bit environment, but when you try to run on a 64 bit environment you are unable to connect. 您似乎需要64位驱动程序,因为它显示了在32位环境下运行的Windows上一切正常,但是当您尝试在64位环境下运行时无法连接。 Having 32 bit office is not going to solve this problem because windows is still running in a 64 bit environment.
具有32位办公室将无法解决此问题,因为Windows仍在64位环境中运行。 You would assume that it should be able to run anything 32 bit inside of a 64 bit environment, however that is not always the case and is never the case trying to run 64 bit inside a 32 bit environment.
您将假设它应该能够在64位环境中运行任何32位环境,但是并非总是如此,并且在32位环境中尝试运行64位环境绝非如此。 I would look into trying to get 64 versions if possible.
如果可以的话,我会尝试获得64个版本。 That should negate your problem.
那应该消除你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.