Solved

How do you process a .txt file and then parse it with string commands.

Posted on 2004-08-08
2
196 Views
Last Modified: 2010-04-23
I am processing a text file that is approximately 4000 characters wide and about 4000 records long.  There is no seperation in the file.  I only know the start and stop positions for each field.  I need to extract each field into a variable and then write it to a SQL database.  Can someone give me some ideas on how to do perform this job.  Thanks for your help.

Kenny
0
Comment
Question by:kwh3856
2 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 11749796
well you will be reading it as a stream ...

http://www.experts-exchange.com/Programming/Q_21014373.html shows one ...

you could also use random access if you wanted wich will make things a bit easier in code ... http://www.codeproject.com/vb/net/ybrandomfile.asp gives an example of this, this method is nice because it reads directly into a structure.
0
 

Author Comment

by:kwh3856
ID: 11749842
Gregory,
Thanks for steering me in the right direction.  I found this link at Microsoft which was exactly what I needed.

Thanks
Kenny

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconReadingTextFromFile.asp

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question