How to resolve the following error when using ASP to connect to an ACCESS database under IIS7
Published: 2012-08-22

Server Error in '/' Application.
The 'microsoft.jet.oledb.4.0' provider is not registered on the local machine.
This is because the Win2008 system we use is 64-bit, whereas previously Win2003 was 32-bit. There are the following two solutions:
1. Modify the code for connecting to the database:
If the original code is
DataPath = "App_Data/#data.mdb";
String constring = "provider=microsoft.jet.oledb.4.0;data source=" + HttpContext.Current.Server.MapPath(DataPath) + "";
The modified version is:
DataPath = "App_Data/#data.mdb";
string constring = "provider=Microsoft.ACE.OLEDB.12.0;data source=" + HttpContext.Current.Server.MapPath(DataPath) + "";
Note: only the part in red font needs to be modified; no other changes are needed. That is, switch to another database connection driver.
2. In our backend, change to 32-bit compatibility mode:
Log in to our website backend and enter the Management Center Business ManagementàVirtual Host ManagementàManageàProgram Compatibility Mode
After submission, it can be used normally.
