Home All Groups Group Topic Archive Search About

Binding Data to Dataset or Table

Author
26 Aug 2006 6:23 AM
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.

Author
26 Aug 2006 8:18 AM
Cor Ligthert [MVP]
Jimmy,

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

Cor

Show quoteHide quote
"JimmyKoolPantz" <kohl.m***@gmail.com> schreef in bericht
news:1156573435.971132.95890@p79g2000cwp.googlegroups.com...
>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.
>
Author
26 Aug 2006 7:32 PM
JimmyKoolPantz
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)



Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Jimmy,
>
> Most likely your connection string, but if you don't show that, than the
> chance that somebody can help you is zero.
Author
27 Aug 2006 5:01 AM
Cor Ligthert [MVP]
Jimmy,

Mostly has this to do with the quotes you are using, and I think that it is
in your case the same.

Both Ken and Paul have written something about your question in this thread

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_frm/thread/4bb49f484a9b3b5c/fb75aac56c0fba44?#fb75aac56c0fba44

I hope this helps,

Cor


Show quoteHide quote
"JimmyKoolPantz" <kohl.m***@gmail.com> schreef in bericht
news:1156620739.284848.127830@m73g2000cwd.googlegroups.com...
> 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)
>
>
>
> Cor Ligthert [MVP] wrote:
>> Jimmy,
>>
>> Most likely your connection string, but if you don't show that, than the
>> chance that somebody can help you is zero.
>