HDR in Jet conn string

G

Guest

Hello,

I building an automatic parser in .NET that opens an XLS using OLEDB's Jet driver. In the connection string it allows you to add "HDR=Yes" as an extended property if the first line has the column titles instead of the data (so the OLEDB will skip the first line). This is a great option, but how does one determine whether the first line should be skipped or not at run time? With a CSV file it is possible to just open the file as text, read the first line, and look at it (i.e. to find if it contains "Zip Code" and "Phone") to determine whether to tell OLEDB to skip it. But this doesn't work with XLS. Any suggestions would be appreciated!
 
S

Steven Cheng[MSFT]

Hi,

As for the checking whether the xls sheet contains a titile line problem.
It seems that currently we haven't any good means to check it before we
load the data into our data collection. As you have mentioned that the xls'
file has its particular format which is hard to parse through it.
However, since in .net, we can use OLEDB provider to connect a xls file and
retireve the data into DATASETvia DataAdapter, I think we can do the
checking after the loading the data into dataset. Then, we if it contains
the title row, we can set the columns' name property according to the title
row and remove this datarow. Do you think so?
Also, if you have any other ideas ,please also feel free to post here.
thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top