1 Previous Next 

Acess (OleDB): VS.Net 2005 Open database in 64 bit OS


If you try and open an access database on a 64bit os you will get the following error. System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. To prevent this open My Project -> compile -> advanced compiler options and set the target cpu to x86. There currently is not a 64bit version of the provider by selecting the x86 option you force the framework to use the 32 bit version.     Dim ds As New DataSet

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim conn As OleDbConnection
        Dim strConn As String
        Dim da As OleDbDataAdapter

        strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
        strConn &= "Data Source = c:\Northwind.mdb;"


        conn = New OleDbConnection(strConn)
        ds = New DataSet
        da = New OleDbDataAdapter("Select * from Products", conn)
        Try
            da.Fill(ds, "Products")
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
        DataGridView1.DataSource = ds.Tables("Products")
    End Sub



1 Previous Next