29/03/2013

How to fix the "Microsoft.Jet.OLEDB.4.0  provider  is registered" error? VB.Net Code for beginners

This error generally pup up with Window-7  of 64 bit version not with 32 bit because:
  • Microsoft Access database provider(the Microsoft.Jet.OLEDB.4.0 provider) is not available in a 64 version- it is only available as 32- bit.
  • Generate the " Microsoft.Jet .OLEDB.4.0 provider is not registered on local machine" error when attempting to load a form that connects to database.
For fixing this error depends o whether you are running Visual Studio Ultimate Edition or the Visual Basic Express Edition.
For Visual Basic Ultimate Edition Fix: In order to connect to an Access database when running Visual Studio on a 64-bit machine, you need to specify for Visual Studio to use 32-bit mode.Follow following steps
  • 1.   Open Solution Explorer -- click on the My  Project node to the My Project
  • 2.   Click the Compile tab along the left side of My Project --shown below will display.
  • 3.   Click the Advanced  Compile  Options... button tothe Advanced Compiler Settings dialog box.
  • 4.   Click the Target CPU drop-down arrow and select the x86 target --this will allow your program to run in 32-bit mode.
For Visual Basic Express Edition Fix: Use this procedure if you are running Visual Basic Express Edition. In order to connect to an Access database when running Visual Studio on a 64-bit machine, you need to specify for Visual Studio to use 32-bit mode; however, the above procedure will not work because the Advanced Compiler Settings window will not display a Target CPU drop-down box. Instead, you will need to carefully modify the project file using a text or XML editor.
  • 1. With your VB application program open, select the File menu, Close Project option to close the project and/or solution as shown in this figure.
  • 2.   Select File menu, Open File option as shown in
  • 3.   Navigate (browse) to the project directory, and highlight the project file (the file is inside the solution folder for your project and ends in the filename extension of .vbproj as shown in this figure). After highlighting the project file, click the Open button.                    
  • 4.   After opening the file, it should display (open) in an XML editor window.
  • 5.   Locate the first <PropertyGroup> section and add the following
<PlatformTarget>x86</PlatformTarget>
  • 6.   Save the project (.vbproj) file. You can now reopen the project—use the File menu, Open Project option to browse for the project folder and click the solution file (.sln) to open the project, and continue with your debugging and testing.

No comments:

Post a Comment

What & How