Generate a report in .txt file datasource is SQl server in

Dear Experts,
In my application , I need to generate a .txt file from sql server as datasource,This .txt file is a report that contains sub reports,my question is what is the best possible way to generate this .txt file either export from crystal report or direct formatting th .txt file.
I need code as an example as i am not so proficient in programming,pls find the attached file ......
Who is Participating?
If its a formatted text file ..then it must be written manually by you using code and iterating thru the datasorce.

StringBuilder sb = new Stringbuilder();

Foreach row in datasource.rows
   format the row as you like in the text file

using (StreamWriter outfile =
            new StreamWriter(path + @"\filename.txt"))
By subreport do you mean there where be child records that doesnt fit the overall record structure of the text file? Is an XML file allowable? Simple to fill a dataset from Sql and call a method to export to an xml file, even with nested child records.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.