Recently, Microsoft. Jet. oledb is a project mainly used to import data from Excel. It has been normal during debugging. However, when the data is imported to the customer's Environment (Windows Server 2008 r2 + Server 2000 + iis7), the data import function becomes faulty.
The error is as follows:
System. invalidoperationexception: Microsoft. Jet. oledb.4.0 is not registered on the local computer.Program.
In system. Data. oledb. oledbserviceswrapper. getdatasource (oledbconnectionstring constr, datasourcewrapper & datasrcwrapper)
In system. Data. oledb. oledbconnectioninternal.. ctor (oledbconnectionstring constr, oledbconnection connection)
In system. Data. oledb. oledbconnectionfactory. createconnection (dbconnectionoptions options, object poolgroupproviderinfo, dbconnectionpool, dbconnection owningobject)
In system. Data. providerbase. dbconnectionfactory. createnonpooledconnection (dbconnection owningconnection, dbconnectionpoolgroup poolgroup)
In system. Data. providerbase. dbconnectionfactory. getconnection (dbconnection owningconnection)
In system. Data. providerbase. dbconnectionclosed. openconnection (dbconnection outerconnection, dbconnectionfactory connectionfactory)
In system. Data. oledb. oledbconnection. open ()
In exceloperation. importfromexcel (string filename, string strsql)
In retiree_importdata.btnimport_click (Object sender, eventargs E)
In system. Web. UI. webcontrols. Button. onclick (eventargs E)
In system. Web. UI. webcontrols. Button. raisepostbackevent (string eventargument)
In system. Web. UI. Page. raisepostbackevent (ipostbackeventhandler sourcecontrol, string eventargument)
In system. Web. UI. Page. processrequestmain (Boolean includestagesbeforeasyncpoint, Boolean includestagesafterasyncpoint)
Later, I learned that the customer's operating system is 64-bit and the 32-bit application option is set to true in the IIS program pool settings. The problem is solved immediately as follows:
If you do not want to update the configuration of the IIS program pool, you can compile the program into x86. For details, see:
Failed to Load file or assembly XX or one of its Dependencies
========================================================== ====
2013-04-
Today, another problem occurs, also caused by a 64-bit system. For Windows Server 2003 64-bit, the error is also "Microsoft. jet. oledb.4.0 "provider", but the solution is different from that of Windows Server 2008 64-bit. The specific steps are as follows:
1. Save the following script as BAT and run it:
Cd % systemdrive % \ windows \ system32cscript % systemdrive % \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/apppools/limits 1% SystemRoot % \ Microsoft. NET \ framework \ v2.0.50727 \ aspnet_regiis.exe-I
2. Retry case. Net framework2.0
Solve the problem.
The Microsoft. Jet. oledb.4.0 provider is not registered on the Local Computer