"Provider = Mircrosoft.Jet.OLEDB.4.0;" is not registered on the local machine?

qadeer37

Well-known member
Joined
May 1, 2010
Messages
63
Location
Hyderabad,pakistan
Programming Experience
1-3
"Provider = Mircrosoft.Jet.OLEDB.4.0;" is not registered on the local machine?

Imports db = System.Data


Public Class Form1

Private Sub btnConnection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnection.Click
Dim sConnection As String
Dim dbConn As db.OleDb.OleDbConnection

Try


sConnection = "Provider = Mircrosoft.Jet.OLEDB.4.0;" & "Data Source= Customer.accdb"

dbConn = New db.OleDb.OleDbConnection(sConnection)
dbConn.Open()

MessageBox.Show(dbConn.State.ToString())

Catch ex As Exception
Dim msg As String = String.Format("{0} Threw exception: {1}", ex.Source, ex.Message)
MessageBox.Show(msg)

End Try


End Sub
End Class

it is giving this exception.... "Provider = Mircrosoft.Jet.OLEDB.4.0;" is not registered on the local machine.

I am trying to make connection to an access file. I have Microsoft visual basic 2008 express edition and access 2007.
:mad:
 
The Access database *.accdb doesn't use the Jet 4.0 engine (Jet 4 can't read/write that file format, it's too old) You need to use the ACE 12 driver instead (Ace 12 can read/write anything Jet 4 can plus the new *.accdb format too) so here's the connection string you need to be using: Access 2007 Connection String Samples - ConnectionStrings.com

Also the Ace 12 driver is not included in the .Net framework like Jet 4 is, so you'll need to make sure your installer has the Ace 12 installer (as a prerequisite): 2007 Office System Driver: Data Connectivity Components

Another thing to note here is in the error message you've provided you'd never get a 'Jet 4 is not registered' unless your .Net app is running in 64Bit mode on a 64Bit computer. Jet 4 and Ace 12 do not have a 64Bit they are 32 Bit only and thus you need to set your app to run in x86 mode (even on x64 systems). Since you've included that you're using an Express edition, here's an article that'll tell you how to change the target cpu for your app(s): VB Express target x86 Platform?
 
Back
Top