Solution for Windows Vista Ultimate 64 bit issue: The ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine

// March 18th, 2009 // General

Background:

I am comitted to resolve any programming issues that arise on my Windows Vista Ultimate installed on my HP Artist Edition Laptop DV2899ee. As Vista being the most criticized operating system for development purposes. I do have plans for getting Mac and switching back to Windows XP on my Windows machines but right now I like the Windows Vista experience and it works for me.

My friend Tahir Bashir (a great coder), who works for me under the umbrella of Universal Coders, is working again on the software that we did for AlHadeed Corporation back in 2006. It was not being used by these guys due to less adoption and computer literate manpower but they again are improving the work and so, we are re-developing the software in accordance with the new needs of Mr. Haider the CEO of AlHadeed Corporation Mansehra. He also happens to be the husband of my cousin so I am really taking personal interest in development of this software.

The Problem:

The problem I faced last night, when Tahir sent me the software was that I was unable to run it on my Visual Studio 2008 on Windows Vista Ultimate 64 bit. I was having a problem that is shown in the following screen shot.

Database connection string for Access which produces the error

Visual Studio 2008 Exception Dialog whoing the error

The excpetion window says,  “Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine”. My OS is Vista x64 and Visual Studio 9. But this error does not occur on Tahir’s Win XP Pro machine.This happens while using the debug button.

Exception details

System.InvalidOperationException was unhandled
Message=”The ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine.”
Source=”System.Data”
StackTrace:
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at AlHadeed.MainForm.SelectBasicItems(Int32 mode, Int32 target, Int32 index1, Int32 index2) in C:\Users\Fahd Murtaza\AlHadeed\AlHadeed\Form1.cs:line 289
at AlHadeed.MainForm.ItemPanel_VisibleChanged(Object sender, EventArgs e) in C:\Users\Fahd Murtaza\AlHadeed\AlHadeed\Form1.cs:line 103
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at AlHadeed.MainForm.SalesBtn_Click(Object sender, EventArgs e) in C:\Users\Fahd Murtaza\AlHadeed\AlHadeed\Form1.cs:line 40
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at AlHadeed.Program.Main() in C:\Users\Fahd Murtaza\AlHadeed\AlHadeed\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Solution

Anyhow the reason for this problem is simple. Visual Studio itself is a 32 bit application so it can use 32 bit components. But my Visual Studio 2008 settings were for 64 bit application. Its OK with other Database Strings but not for MS Access as there is no 64bit version of Jet. Using a 64bit data provider (which doesn’t exist I believe, correct me if I am wrong), or spin off your database work to a 32 bit process. So I changed the settings for my application this way. Its shown in the screenshot below.

If you are experiencing the same issues, right click your project and choose the “Properties”, then select the “Build” page. Find the “Platform target” selection ComboBox. Please change the default “Any CPU” into “x86” then build your application again.

Solution to the problem: Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

Solution to the problem: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

Voila! Solves the issue perfectly. No more bloody exceptions!

3 Responses to “Solution for Windows Vista Ultimate 64 bit issue: The ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine”

  1. Offertuth says:

    ehh.. funny ))

  2. JAY says:

    I installed a Domino Exam Simulation Software on my laptop which runs on vista 64 bits and this issue resolved above comes on after i try to run the application after installation.

    What do i do to resolve this?

  3. Riccardo says:

    Is a solution if your application is write in asp.net… if you MUST write your application in asp classic the solution i think it’s not the same… In this moment i don’t look the solution… and u ? R.

Leave a Reply