The 64-bit system uses the Access database file to completely solve the problem.
Recently, a PDF. NET user asked me how I could not Access the Access database in a 64-bit system. Why didn't I encounter the first problem? Today, we can see that our VS and Office versions are both 32-bit, so there is no problem in debugging Access in VS, but we can directly use the compiled version. NET program Access to Access, there is a problem, report:
The Microsoft. Jet. Oledb.4.0 provider is not registered on the local computer.
As a result, I did an experiment on the company's computer (Win7 64-bit) and found that the problem was the same as that of Win8.1 64-bit in my family. I searched the internet and most of them recommended that I. when the NET program was compiled, the target platform was set to x86. I tried it and it was successful.
However, what if your. NET program is compiled by someone else and runs on a 64-bit system to Access the Access database?
First of all, check whether the. NET program can be configured to run in a 32-bit system through the application configuration file. after a long time of searching for information, you can give up.
Think about it, isn't it related to your Office being 32-bit?
The key issue is not the Access 2010 or Access 2013. You don't have to be an expert. Why not install an Access 2007/2010 Database Engine.
Solution:
① Download and install Microsoft Access Database Engine 2010 Redistributable (28 MB). There are two versions: 32bit (download) and 64bit (download, the specific installation depends on whether your Office program is 32bit or 64bit. For example, if my PC is 64bit Win8 pro, but my officeprogram is 32bit, I should install accessdatabaseengine.exe (32bit );
② Open your.. NET application configuration file (Application name. config. The Web application is Web. config), set the Provide Microsoft. ACE. OLEDB.12.0, for example, the standard connection string is: "Provider = Microsoft. ACE. OLEDB.12.0; Data Source = Data. accdb; Persist Security Info = False ;"
Run the program again. OK, the database connection is successful, and everything is normal.
Note: In a 64-bit system, you must change the provider to Microsoft. ACE. OLEDB.12.0. The file name can be an early mdb file or a new accdb file.
If you are a 64-bit system but your Office is 32-bit, you can only install the 32-bit ACE driver.. NET applications can only be published to 32-bit versions. If the application is compiled to the anycpu version, ACE cannot be accessed.
(PS: If you release the target platform in x86 format and do not want to use Access database files in accdb format, you do not have to install the above 32-bit ACE driver, saving you the trouble: -《)
Note:
If you have installed a 64-bit Access program, but debug the Web Site Application in VS2013, the system prompts "Microsoft. ACE. OLEDB.12.0 "is not registered. Please select 64-bit IIS Express in VS options, project and solution, Web project.