Solved

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

Posted on 2004-08-08
2
195 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now