'Could not find installable ISAM. when taking data from excel sheet

i am trying to get data from excel sheet 2019 using oledb, but when i debug it, it gives me error "Could not find installable ISAM.", should i install something to my pc or is it a code error?

Public Class Form1
Function GetDataFromExcelSheet(ByVal FilePath As String, ByVal sql As String) As DataTable
    Dim connection As New OleDb.OleDbConnection
    Dim command As New OleDb.OleDbCommand
    Dim da As New OleDb.OleDbDataAdapter
    Dim dt As New DataTable
    connection.ConnectionString = "provider = microsoft.ace.oledb.12.0; data source = " & FilePath & "; Extented Properties=Excel 12.0"
    command.Connection = connection
    command.CommandText = sql
    da.SelectCommand = command
    da.Fill(dt)
    Return dt
End Function

Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
    Dim dt As New DataTable
    dt = GetDataFromExcelSheet("C:\Users\User\Desktop\test2145.xlsx", "select distinct class from [Sheet1$]")
    Me.ComboBox1.DataSource = dt
    Me.ComboBox1.DisplayMember = dt.Columns(0).ToString
    Me.ComboBox1.ValueMember = dt.Columns(0).ToString
    Me.ComboBox1.SelectedIndex = 1
End Sub
End Class

visual studio says the error is in "da.Fill(dt)"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source