HDR=No doesnt work
Hi Guru's
I have a little problem while reading the data from a CSV file. I use the
ODBCAdapter.Fill() method to populate data in a data table. But some how the connection does not recognize the HDR=No parameter.
The first row in the CSV file is data and not the Column Headers.. But still the first row is treated as Column Header. Can any one help in this... its very urgent...
Below is the code...
Code:
Try
strConn = "DefaultDir=" & sDir & ";Driver={Microsoft Text Driver (*.txt; *.csv)};Extended Properties='text;HDR=No;'"
Dim strSelect As String
Dim conn As Odbc.OdbcConnection
conn = New Odbc.OdbcConnection(strConn)
conn.Open()
strSelect = "Select * from " & textFile
odbcAdpater = New Odbc.OdbcDataAdapter(strSelect, conn)
odbcAdpater.Fill(dt)
conn.Close()
Return dt
Catch ex As Exception
myErrCol.Add(ex.Message)
End Try
Nilesh
Pune, Maharashtra
India