question

BobWentzel-6283 avatar image
0 Votes"
BobWentzel-6283 asked AlbertKallal-4360 edited

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

I am unable to get beyond this error when trying to add a Microsoft Access database (.accdb) as a data source in Visual Studio 2019. I’ve tried to add this data source to a Visual Basic and C# program with the same results. I’ve followed guidance I’ve found on the Internet and added the 2010, 2013, and 2016 Access database engines all with the same result. I’ve changed the TargetCPU to AnyCPU, X86, and X64 all with the same result. I can add an Access .mdb database as a data source but not an .accdb and my application requires the later database format.

My system is running Windows 10 x64 with Office 365 and Visual Studio 2019 all with the latest updates.

Disclaimer: I am a hobbyist programmer and this application is for a single user (me) and I prefer to use Access because I have it as part of Office 365 and it is easy to create and view dataset objects and their content. Many do not like Access and that’s understandable in a business multi-user environment. Many also prefer other languages like Python but I will stick with Visual Basic (or possibly Micro Focus COBOL) for personal reasons. Lastly, my request for help is not an invitation to you to try to sell me your curriculum (as experienced on Facebook).
105426-add-connection.jpg105375-choose-data-source.jpg105365-error.jpg105408-targetcpu.jpg


dotnet-visual-basicoffice-access-dev
add-connection.jpg (99.1 KiB)
error.jpg (125.2 KiB)
targetcpu.jpg (128.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @BobWentzel-6283 ,
If you don't use 'Data Source Configuration Wizard', try the following code to get Access database data(set 'Target CPU' to 'x64').

         Dim commandText As String = "SELECT * FROM yourTable"
         Dim connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=your accdb file path"
         Dim bindingSource As BindingSource = New BindingSource
         Using oleDbDataAdapter As OleDbDataAdapter = New OleDbDataAdapter(commandText, connectionString)
             Using dataTable As DataTable = New DataTable
                 oleDbDataAdapter.Fill(dataTable)
                 bindingSource.DataSource = dataTable
                 ' For example, bind bindingsource to datagridview
                 DataGridView1.DataSource = bindingSource
             End Using
         End Using
0 Votes 0 ·
OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered

Visual Studio is a 32 bit application and therefore you have to install ACE as 32 bit data provider to use it in VS wizards; have you?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BobWentzel-6283 avatar image
0 Votes"
BobWentzel-6283 answered AlbertKallal-4360 edited

I was surprised to learn that VS2019 is a 32 bit application so thanks for that bit of knowledge.

I am unable to install the 32 bit Access engine because my Office 365 is 64 bit. Also, I can add .mdb Access databases as a data source using the same process so I wonder if there is something else going on. Thanks for your recommendation.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am unable to install the 32 bit Access engine because my Office 365 is 64 bit.

Have you tested with /passive or /quiet flag ?
(I installed both 32 and 64 engines on my OS)

0 Votes 0 ·

as a follow up, while VS is x32 bits? You can STILL build and use a x64 application. And you can STILL use the connection builders in VS. But, you can't use test connection, and you can't use wizards that have to pull data.

However, if you installed x64 ACE data engine, then the application will run. So, you can use Access x64 data engine with VS and a x64 bit application. And even the connection builder can be used (but test connection for Access x64 will never work. You have to RUN (or debug) the application and then .net can connect + consume data using the x64 bit provider for Access.

Also, do not that you can NOT place your data files on one drive - it will not work.

0 Votes 0 ·