Hi All,
I'm taking a different approach to importing the csv to access and trying to import the csv to the dataset.
I've found the following code but it's giving me an error
Dim fileToOpen As String
Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()
fileToOpen = ImportFiles.SelectedItem
If fileToOpen <> "" Then
Dim cn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\myFilePath\;Extended Properties=" & _
ControlChars.Quote & "Text;HDR=YES;FMT=Delimited" & ControlChars.Quote)
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM C:\Users\myFilePath\" & fileToOpen, cn)
cn.Open()
da.SelectCommand = cmd
da.Fill(ds)
cn.Close()
Me.DataGridView1.DataSource = ds.Tables(0)
Else
MsgBox("Please choose a file to open from the list below!")
End If
The error: Syntax error in FROM clause
I can't figure out why it is producing this error.