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

Dear Experts,
In my vb.net 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 vb.net code as an example as i am not so proficient in programming,pls find the attached file ......
sachin_upadhyayAsked:
Who is Participating?
 
dshrivallabhCommented:
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
Next

using (StreamWriter outfile =
            new StreamWriter(path + @"\filename.txt"))
        {
            outfile.Write(sb.ToString());
        }
0
 
Tommy11bCommented:
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.
0
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.