Binding Data to Dataset or Table

  • Thread starter Thread starter JimmyKoolPantz
  • Start date Start date
J

JimmyKoolPantz

I have an ongoing problem that I can not seem to figure out.

The problem is everytime I bind data to a dataset or datatable where
the data source does not have a "header row" the first record in the
datafile always shows up in the header of the dataset or table.

Is there a simple solution to this problem? I have tried different
connection strings with extended properties "HDR=Yes" and I have tried
"HDR=NO" but nothing seems to work. the only solution I have found is
to bind the datafile to the dataset and then create a new table with
column headers and then pull the first record out of the header of the
dataset. However, I am looking for qucker processing time.

The problem files that I have came across are text files, and .csv
files. I am using vs.2005.

Also, since every datafile is in a different format, I can not set
connection properties at design time, I need to do this at runtime.
Some of the files I deal with are 80,000 records long, so you can see
why I do not want to import the data in the dataset, and then create a
new table and process the reocords again.
 
Jimmy,

Most likely your connection string, but if you don't show that, than the
chance that somebody can help you is zero.

Cor
 
The two connections strings that I wrote about are:
text files(odbc connection)
cs = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=" + FilePath

excel files(oledb connection)
cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FilePath +
";Extended Properties=""Excel 8.0;IMEX=1"""

I have tryed using extended properties "HDR=YES" and HDR=NO" and still
the first record was still in the header, however, I might not have
coded it correctly or overlooked something.
cs = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=" + FilePath +
";Extended Properties=YES" (I have tried NO also)
 
Back
Top