OLEDB Connection using without physically installing the driver

旧城冷巷雨未停 提交于 2021-02-18 14:00:08

问题


I have been trying to access the MS Access database file residing on my machine and it works just fine when I have office installed.

When I try to use the same code on a machine that does not have office installed/driver installed it throws up an error "Microsoft.ACE.OLEDB.12.0 provider is not registered"

I followed up on this post Microsoft.ACE.OLEDB.12.0 provider is not registered but the solution here is to install the redistributable physically.while I would like to do it programmatically using C#.

Would that be possible only by installation physically, is this the only way out?


回答1:


If your application uses the Microsoft.ACE.OLEDB.12.0 driver then that driver must be installed on the machine. To (directly) access the database file "programmatically using C#" would essentially involve you (re-)writing Jackcess in C#. That would be a huge amount of work and would make no real sense (since the proper ACE.OLEDB driver for Windows is already freely available).

One alternative would be to use the Microsoft.Jet.OLEDB.4.0 driver instead. The (32-bit) Jet driver is installed with every copy of Windows. However, you would face the following restrictions:

  1. Your application would only be able to manipulate .mdb files, not .accdb files, and
  2. Your application would have to be built as a 32-bit application.


来源:https://stackoverflow.com/questions/24525742/oledb-connection-using-without-physically-installing-the-driver

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!