473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading a Text file

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

Mar 24 '06 #1
3 1033
Sudhesh schrieb:
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
Mar 24 '06 #2
On 24 Mar 2006 10:33:52 -0800, "Sudhesh" <Su*****@mail.com> wrote:
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.
Mar 24 '06 #3

"Sudhesh" <Su*****@mail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
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?

Mar 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
19
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much...
0
by: Eric Lilja | last post by:
Hello, I have a text file that contains a number of entries describing a recipe. Each entry consists of a number of strings. Here's an example file with only one entry (recipe): Name=Maple Quill...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
50
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem...
2
by: Sabin Finateanu | last post by:
Hi I'm having problem reading a file from my program and I think it's from a procedure I'm using but I don't see where I'm going wrong. Here is the code: public bool AllowUsage() { ...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
4
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0...
3
by: The Cool Giraffe | last post by:
Regarding the following code i have a problem. void read () { fstream file; ios::open_mode opMode = ios::in; file.open ("some.txt", opMode); char *ch = new char; vector <charv; while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.