On Thu, Sep 2, 2010 at 8:44 AM, Iain <[email protected]> wrote: > Hi All > > I hope someone can help as I am stumped. > > Usuing Visual Studio 2008, C#, Dot Net Level 3.5 to create a web page > application. > > The following is in a button.click event. > > The task I have been given is to retrieve a dataset from a database (a > payment list). > This dataset is of indeterminate size (ie it will contain anything > from 1 to hundreds of > records). I have to take the data and reformat the records into a > seperate text file, > each text file containing no more than 50 records. So, in essence, if > I have a dataset > of 125 records I will end up with 3 text files, 2 containing 50 > records and 1 containing > 25 records. These files are to be stored on the user's desktop for > further processing. > > After the every 50 records I am trying to save a file to the desktop. > I want to assign > a different name to the file each time > > ie > > filename-1.txt (containing maximum 50 records) > filename-2.txt (containing maximum 50 records) > filename-3.txt (containing the residue) -------------------
Why not combine all the text files in memory to a zip stream and make a single compressed file instead? I have to do same thing with pdf documents instead of with .txt fiels but it works great. Better is less writing a stream. HTH -- Stephen Russell Sr. Production Systems Programmer CIMSgts 901.246-0159 cell
