Greetings everyone, it turns out that I am making an importer that consists of loading data from an Excel file to a table made in SQL Server (In an app made in VB.NET), I am adapting a code according to my needs and when importing the Excel file gives me the following error
The Microsoft ACE.OLEDB.12.0 provider is not registered on the local computer.
It is worth mentioning that I have office 2016 installed on my PC, the visual studio I use is VB 2010 Pro, I don't know if that is the reason for my error, I greatly appreciate any guidance you can give me.
Sub excelAsql()
Dim myFileDialog As New OpenFileDialog()
Dim xSheet As String = ""
With myFileDialog
.Filter = "Archivos de Excel |*.xlsx"
.Title = "Abrir archivo excel"
.ShowDialog()
End With
If myFileDialog.FileName.ToString <> "" Then
Try
Dim ExcelFile As String = myFileDialog.FileName.ToString
xSheet = InputBox("Nombre de la Hoja", "")
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & "data source=" & ExcelFile & "; " & "Extended Properties='Excel 12.0;HDR=Yes'")
conn.Open()
da = New OleDbDataAdapter("SELECT * FROM [" & xSheet & "$]", conn)
Dim dt As New DataTable
da.Fill(dt)
frmLista.DataGridView1.DataSource = dt
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
Fixed (based on my personal experience)!
with Install the following Driver Data connectivity components