Reading a Text file

S

Sudhesh

Hi,
I know its fairly easy in .NET to read a text file (fixed or
delimited) using a Microsoft Text driver. My question is, is there a
similar easy way to read text files if they have different types of
rows, like a header, detail & footer. The first character on each line
could identify what type of row that is.
I'd hate to think that reading each line is the only answer. Also
if the fields in header and footer are different, can you process them
differently. Ideally, I'd like to create a dataset with 3 tables linked
together, one each for header, detail & footer.

Cheers
Sudhesh
 
M

Martin Schall

Sudhesh said:
Hi,
I know its fairly easy in .NET to read a text file (fixed or
delimited) using a Microsoft Text driver. My question is, is there a
similar easy way to read text files if they have different types of
rows, like a header, detail & footer. The first character on each line
could identify what type of row that is.
I'd hate to think that reading each line is the only answer. Also
if the fields in header and footer are different, can you process them
differently. Ideally, I'd like to create a dataset with 3 tables linked
together, one each for header, detail & footer.

Cheers
Sudhesh

Hello,
i don't think, there is a ready-to-use solution in .Net for this. I
think, that the only way is reading the file line for line and then
parse it into the three tables.

Martin Schall
 
J

Joe Cool

Hi,
I know its fairly easy in .NET to read a text file (fixed or
delimited) using a Microsoft Text driver. My question is, is there a
similar easy way to read text files if they have different types of
rows, like a header, detail & footer. The first character on each line
could identify what type of row that is.
I'd hate to think that reading each line is the only answer. Also
if the fields in header and footer are different, can you process them
differently. Ideally, I'd like to create a dataset with 3 tables linked
together, one each for header, detail & footer.


I don't think the Microsoft TExt driver can do that. If the different
types of records were in separate files with a common key, you could
join them just like you would join several database tables.
 
H

Homer J Simpson

I know its fairly easy in .NET to read a text file (fixed or
delimited) using a Microsoft Text driver. My question is, is there a
similar easy way to read text files if they have different types of
rows, like a header, detail & footer.

How can a plain text file have a header or footer?
 

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

Top