Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing out a Recordset as a Text File (How?)

Status
Not open for further replies.

Becks25Not

Programmer
Jun 23, 2004
176
US
I have to create a program that reads in text files and writes the text file back out overwriting certain fields based on various rules. The text file could have up to 4 million records. Because I have quite a bit of manipulation to do with them, I have coded it so far to load part of the file into a recordset, manipulate it, then write it out to a text file, delete what's been done from the recordset and then load more of the text file in.

My problem is write the recordset to the text file. Currently, I am concatenating all the fields together as a single string, writing that record out then moving next, is there any other way? or a better way of handling the file?

Thanks!!
 
I was doing the same thing, reading a text file into datasets etc, and then writing them back out to txt files.

As you have probably discovered, there is plenty of code to write and I got to the stage where I stopped it all and put it into an access database figuring I would get the user to get the jet drivers for the program to work.

Anyway, I don't think there are too many ways you could write it out except the way you are doing it. I haven't worked with a text file as big as yours so I don't know how good it is performance wise, but myabe if it starts to slow down, you could create temporary files and after a certain amount of records, append it to your main txt file.
 
Thanks for the feedback sjn78. I haven't had a chance to test the bigger files yet, so hopefully everything will go ok!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top