Question Error with Microsoft.Jet.OLEDB.4.0

Bazilin

Member
Joined
Jul 22, 2013
Messages
7
Programming Experience
Beginner
Hello everybody...!
i'm Bazilin and new here.

I'm facing a problem to connect vb with ms access.

Here is my code that i'm using;

Imports System.Data
Imports System.Data.OleDb

Public Class Form1

Dim sbgnOLEDB As New OleDbConnection
Dim arahanOLEDB As New OleDbCommand
Dim arahanInsert As New OleDbCommand
Dim arahanUpdate As New OleDbCommand
Dim arahanDelete As New OleDbCommand
Dim SambunganDatabase = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Environment.CurrentDirectory & "\TestWithVB"

but when i debug it the error say Microsoft.Jet.OLEDB.4.0 is not registered.
i've tried search for solution including install AccessDatabaseEngine but it does'nt work.

any idea anybody?

thank you.
clear1x1.gif
:spiny:
 
Make sure that your project is targeting the x86 platform, which will force it to run in 32-bit mode on all systems. If it's targeting Any CPU then it will run in 64-bit mode on 64-bit systems, but there is no 64-bit version of Jet.

By the way, don't do this:
Dim SambunganDatabase = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Environment.CurrentDirectory & "\TestWithVB"
you should be doing this:
Dim SambunganDatabase = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\TestWithVB"
Presumably your file name should a ".mdb" extension too.
 
Thanks a lot jmcilhinney 'cause replied me. I'm really happy.

My OS is windows 7. So it should run in 64bit system is it?

this is the pic for my error. i already put data directory as you said.

error.jpg

You said there is no 64-bit version of Jet, so what should i use? and how?

I had installed
AccessDatabaseEngine but then i don't know how it work.

did i need to change Jet for others name?

Thank you.
 
Even though your system is 64-bit, it still has a 32-bit version of Jet installed. That's why, as I said, you have to force your app to run in 32-bit mode on all systems, i.e. your app will run in 32-bit mode on both 32-bit and 64-bit systems. You do that by setting the target platform to x86 in the project properties, as I said in my previous post.
 
Yup, but i still fail to find it.
i had search for how to setting target platform to x86.
and i get this:

[h=3]To enable x64 as a CPU platform target[/h]
  1. After the project is created, on the Visual Studio toolbar, open the Solution Platforms drop-down list box.
  2. Click Configuration Manager.
  3. In the Configuration Manager dialog, open the Active solution platform drop-down list box and click <New> ….
  4. In the New Solution Platform dialog, select x64 in the Type or select the new platform drop-down list box.
  5. Select x86 in the Copy settings from drop-down list box.
  6. Click OK.
  7. In the Configuration Manager dialog, be sure the box in the Build column is checked for all projects in the solution.
  8. Click Close.

    but in my tools there is no Solution Platforms.


any other ways?
 
You should be able to do it from the Compile page. It was not included there in older versions of VB Express but I thought it had been included in 2010. I know that it definitely has in 2012 but may that's the first. If it's not there then you can still do it but the process is a bit more manual. If you search the web for how to target the x86 platform in VB Express specifically then you'll find instructions on how to edit the appropriate file by hand.
 
Back
Top