A thorough workaround for 64-bit systems using Access database files

Source: Internet
Author: User
Tags microsoft access database

Recently, a pdf.net user asked me how I could not access the Access database under a 64-bit system, and my first reaction was how did I not meet it? Today I see that my vs and office are all 32-bit versions, so debugging access in VS is no problem, but directly using compiled. NET program accesses access, there is a problem, reported:

The "microsoft.jet.oledb.4.0" provider is not registered on the local computer.

So, in the company's computer (Win7 64) Did the experiment, found that with the home Win8.1 64-bit problems, Internet search, most of them are recommended. NET program compile, the target platform is set to x86, I tried, and sure enough success.

But, if you are. NET program is compiled by others, and run on 64-bit systems, to access the Access database, how to do?

First think, see whether the application configuration file, the. NET program to run in 32-bit system, find a long data, no results, give up.

Think again, is not with your office is 32 bit about it?

The key question is not that access 2010 or access 2013, not a bit of a bit, why not the second, install an Access 2007/2010 database engine is not OK.

Workaround:

① Download Install Microsoft Access Database Engine Redistributable (28MB), total 32bit (download) and 64bit (download) two versions, Specifically to install which depends on whether your Office program is 32bit or 64bit, such as: My PC is 64bit Win8 Pro, but my Office program is 32bit, So I should install AccessDatabaseEngine.exe (32bit);

② Open your. NET application configuration file (application name. Config,web application is Web. config), set provide microsoft.ace.oledb.12.0 for the database connection string, such as the standard connection string: "Provider= Microsoft.ace.oledb.12.0;data source=data.accdb; Persist Security info=false; "

Run the program again, OK, the database connection is successful, everything is fine.

Note: Under 64-bit systems, be sure to modify the provider to microsoft.ace.oledb.12.0, and at this point the file name can be an earlier MDB file, or it can be 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, so your. NET application can only be published in 32-bit, if compiled into a anycpu version, still cannot access the ACE.

PS: If you publish to a target platform in the x86 format and do not want to use an Access database file in the ACCDB format, then you do not have to install the above 32-bit ACE driver, save the toss:-")

Attention:

If you installed a 64-bit access program, but when you debug the Web site application in VS2013, the prompt "microsoft.ace.oledb.12.0" is not registered, in the VS option, project and solution, Web project, tick 64-bit IIS Express.

A thorough workaround for 64-bit systems using Access database files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.