Answered by:
How can I fix this error?

Question
-
Hi All,
Dim constring As String = "Data Source=.;Initial Catalog=ProductDB;Integrated Security=True"
Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand("SELECT * FROM Product", con)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)When I run the above code, I got this error message "Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine".
How can I fix it?
Thursday, November 17, 2016 1:11 PM
Answers
-
If you don't have Microsoft Office 2007 or higher installed you will need to install the Access Database Engine:
https://www.microsoft.com/en-us/download/details.aspx?id=13255
If Office is installed then you need to set the project Platform correctly. If 32-bit Office is installed set the Platform to x86. If 64-bit Office is installed then set the Platform for Any CPU or x64.
Paul ~~~~ Microsoft MVP (Visual Basic)
- Proposed as answer by Neda Zhang Thursday, November 17, 2016 1:23 PM
- Marked as answer by Bowlesvb Thursday, November 17, 2016 2:39 PM
Thursday, November 17, 2016 1:17 PM -
Hi Bowlesvb,
Thank you for posting in MSDN Forum.
Here's a discussion about this error, please check and follow the workaround:
HOW TO: FIX ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine"
Please refer to it and let me know whether it is worked for you.
Best Regards,
Neda Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Marked as answer by Bowlesvb Thursday, November 17, 2016 2:39 PM
Thursday, November 17, 2016 1:23 PM
All replies
-
If you don't have Microsoft Office 2007 or higher installed you will need to install the Access Database Engine:
https://www.microsoft.com/en-us/download/details.aspx?id=13255
If Office is installed then you need to set the project Platform correctly. If 32-bit Office is installed set the Platform to x86. If 64-bit Office is installed then set the Platform for Any CPU or x64.
Paul ~~~~ Microsoft MVP (Visual Basic)
- Proposed as answer by Neda Zhang Thursday, November 17, 2016 1:23 PM
- Marked as answer by Bowlesvb Thursday, November 17, 2016 2:39 PM
Thursday, November 17, 2016 1:17 PM -
Hi Bowlesvb,
Thank you for posting in MSDN Forum.
Here's a discussion about this error, please check and follow the workaround:
HOW TO: FIX ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine"
Please refer to it and let me know whether it is worked for you.
Best Regards,
Neda Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Marked as answer by Bowlesvb Thursday, November 17, 2016 2:39 PM
Thursday, November 17, 2016 1:23 PM -
Thank you, it solved!Thursday, November 17, 2016 2:40 PM