Try this function... It'll read the csv file and return a datatable
vb Code:
  1. Private Function CsvToDataTable(ByVal filePath As String) As DataTable
  2.         Dim dt As DataTable = Nothing
  3.         Dim sourcePath As String = String.Empty
  4.         Dim csvFile As String = String.Empty
  5.         Dim conString As String = String.Empty
  6.         Dim conn As OleDb.OleDbConnection = Nothing
  7.         Dim adapter As OleDb.OleDbDataAdapter = Nothing
  8.         Dim selString As String = String.Empty
  9.         Try
  10.             sourcePath = System.IO.Path.GetDirectoryName(filePath)
  11.             csvFile = System.IO.Path.GetFileName(filePath)
  12.             conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sourcePath & ";Extended Properties=""text;HDR=No;FMT=Delimited"";"
  13.             conn = New OleDb.OleDbConnection(conString)
  14.             selString = "Select * From " & csvFile
  15.             adapter = New OleDb.OleDbDataAdapter(selString, conn)
  16.             dt = New DataTable(System.IO.Path.GetFileNameWithoutExtension(filePath))
  17.             conn.Open()
  18.             adapter.Fill(dt)
  19.             conn.Close()
  20.         Catch ex As Exception
  21.             MessageBox.Show(ex.Message)
  22.         Finally
  23.             adapter.Dispose()
  24.             conn.Dispose()
  25.         End Try
  26.         Return dt
  27.     End Function