If you want to read the contents of a CSV file into a DataTable, you can use something like this (assuming that the first line of the file is the Column Names):
Code:
connectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=" & NameOfFolder
conn = New OdbcConnection(connectionString)
'we only pass it the folder. The csv file import is in the query which follows
da = New OdbcDataAdapter("SELECT * FROM " & sFilename, conn)
da.AcceptChangesDuringFill = False
iFileRecords = da.Fill(dt)
NameOfFolder: the folder where your CSV file lives.
sFileName: the Filename of the CSV file.
This will get all of your CSV records into a DataTable (dt) that you can use.
Or you can use an ODBC DataReader if you want...
Code:
Dim ODBC_Command As New OdbcCommand("SELECT * FROM " & sFilename, conn)
ODBC_Command.CommandType = CommandType.Text
Dim ODBC_Reader As OdbcDataReader
ODBC_Reader = ODBC_Command.ExecuteReader
While ODBC_Reader.Read
'Do something
End While