I was looking at the connection string and realized that I was specifying
the directory in the select statement. This seems to be the problem.
If you notice, I have "c:\ImportFile\temp.csv" instead of "temp.csv" in my
select statement. This is exactly the same since temp.csv is in the
c:\importFile directory. I could understand the problem if I was changing
the folder from the connection string. But here is the Connection string I
am using:
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Here "Path" is equal to "c:\ImportFile\" (which is why my select statment
with no path works correctly). But I am not changing the directory so why
would the program act differently? It obviously has nothing to do with
schemi.ini files or being in a different directory. It is exactly the same.
So why does it take out the header (1st line) in one and not the other????
Thanks,
Tom
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
"tshad" <t@home.comschrieb:
>It seems that if I run the program as:
Dim da As New OleDb.OleDbDataAdapter("Select * from " &
"c:\importFile\temp.csv", conn)
It drops the first line. If I run it as
Dim da As New OleDb.OleDbDataAdapter("Select * from " & "temp.csv", conn)
It doesn't drop the first line. That is the only difference. What would
cause this to happen?
Maybe the first line is considered to contain column names? I suggest to
take a look at the connection string used to instantiate the connection
object. It's possible to specify wether to interpret the first row as
column header line there by setting 'HDR' to 'yes' or 'no' there.
Further information:
<URL:http://www.connectionstrings.com/?carrier=textfile>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>