Sarah Proctor Sarah Proctor - 1 month ago 23
SQL Question

Microsoft.ACE.OLEDB16.0 provider not registered on local machine

I'm working on an app using Visual Studio 2013 and Access 2016 and I believe I have everything connected correctly, but when I try to debug the program every time the database is supposed to be used the title message pops up. I have downloaded a lot of different patches, even though I have Access downloaded on my machine. I have also toyed around with using 12.0 and 15.0 in my connection string and none of them have worked. Does anyone have any idea of something to download to show that I have it downloaded? I'll also add my data base control class incase there is a problem with how I wrote it.

Imports System.Data.OleDb
Public Class DBControl
Private DBCon As New OleDbConnection("Provider=Microsoft.ACE.OLEDB12.0;Data Source=StableMe.accdb;")
Private DBCmd As OleDbCommand

Public DBDA As OleDbDataAdapter
Public DBDT As DataTable
Public params As New List(Of OleDbParameter)
Public recordCt As Integer
Public exception As String

Public Sub ExecQuery(query As String)
recordCt = 0
exception = ""

Try
DBCon.Open()
DBCmd = New OleDbCommand(query, DBCon)
For Each p As OleDbParameter In params
DBCmd.Parameters.Add(p)
Next
params.Clear()
DBDT = New DataTable
DBDA = New OleDbDataAdapter(DBCmd)
recordCt = DBDA.Fill(DBDT)
Catch ex As Exception
exception = ex.Message
End Try

If DBCon.State = ConnectionState.Open Then
DBCon.Close()
End If
End Sub

Public Sub AddParams(name As String, value As Object)
Dim newParam As New OleDbParameter(name, value)
params.Add(newParam)
End Sub


End Class

Answer

In the connection string

Provider=Microsoft.ACE.OLEDB12.0

is not a valid provider name because it is missing a period. It should be

Provider=Microsoft.ACE.OLEDB.12.0