I need help every time i run this code i get the same error
Unable to cast object of type 'System.Data.DataTable' to type 'System.Data.DataView'.
the code is
Dim plmExcelCon As New System.Data.OleDb.OleDbConnection
Dim cmdLoadExcel As System.Data.OleDb.OleDbDataAdapter
Dim PrmPathExcelFile As String
PrmPathExcelFile = txtImportFileLocation.Text.ToString
plmExcelCon = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PrmPathExcelFile + ";Extended Properties=Excel 12.0;")
cmdLoadExcel = New System.Data.OleDb.OleDbDataAdapter("select * from [" + txtImportSheetName.Text + "$]", plmExcelCon)
Dim ldExcelDS As System.Data.DataSet
ldExcelDS = New System.Data.DataSet
cmdLoadExcel.Fill(ldExcelDS)
plmExcelCon.Close()
'New
Dim dt As DataTable = ldExcelDS.Tables(0)
Any help Most Appreciated