Below is my function that returns a data table containing the contents of a CSV file. As this CSV file isnt actually record based the field types are mixed. I have used IMEX=1 but data is still missing.
Can anyone tell me off the top of their head what I am doing wrong?
Private Function GetDataADO(ByVal Path As String) As DataTable
Dim Filename As String = IO.Path.GetFileName(Path)
Dim FilePath As String = IO.Path.GetDirectoryName(Path)
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties= ""Text;HDR=No;IMEX=1;"" ; Data Source=" & FilePath
Dim Connection As New OleDb.OleDbConnection(ConnectionString)
Dim Command As New OleDb.OleDbCommand
Command.CommandType = CommandType.Text
Command.Connection = Connection
Command.CommandText = "SELECT * FROM [" & Filename & "]"
Dim DataTable As New DataTable
Dim DataAdapter As New OleDb.OleDbDataAdapter(Command)