Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net (VB.net) Reference for Access 2000

Hi

I am trying to connect to tan Access 2000 database using the code below but am getting the error
'The Microsoft.Ace.OLEDB.4.0' provider is not registered on the local machine
What refderence should I add here
Imports System.Data
Imports System.Data.OleDb


Public Class _Default
    Inherits System.Web.UI.Page

    Dim oFullPath As String = Environ("userprofile") & "\Desktop\Test.mdb"
    Dim ConnectionString As String = "Provider=Microsoft.ACE.OLEDB.4.0;Data Source=" & oFullPath & ";"

    Dim dbadp As OleDbDataAdapter
    Dim dTable As New DataTable

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Call Fill_GridView1()
    End Sub

    Sub Fill_GridView1()
        Try

            Dim sSQL As String

            sSQL = "SELECT * FROM Test"
            Dim connection As New OleDbConnection(ConnectionString)
            dbadp = New OleDbDataAdapter(sSQL, connection)

            dbadp.Fill(dTable)
            Me.GridView1.DataSource = dTable
            'Me.DataGridView1.Columns(0).Width = 0

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub
End Class

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

thanks very much