Hi
I'm trying to import a csv file into a data table without using the first row as a header row. My code is below:
I have looked through tutorials but can't find how to prevent this. I need to read every row and not treat the first row as header row.
Any help would be gratefully appreciated.
Chris
I'm trying to import a csv file into a data table without using the first row as a header row. My code is below:
Code:
Dim Conn As OdbcConnection
Dim dt As New DataTable
Dim da As OdbcDataAdapter
Dim strConnstr, strImportFolder, strFilename As String
strImportfolder = "\\path"
strFilename = "file.csv"
strConnstr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & strImportfolder & "\;"
Conn = New Odbc.OdbcConnection(strConnstr)
da = New Odbc.OdbcDataAdapter("select * from [" + strFilename + "]", Conn)
da.Fill(dt)
I have looked through tutorials but can't find how to prevent this. I need to read every row and not treat the first row as header row.
Any help would be gratefully appreciated.
Chris