I have a stored procedure ( test 1) that returns multiple select results and I would like to write the output ( both header and rows) into a text file using C#
For example, the output from SP looks like below (the sp has multiple select statements)
OrderID
1001
OrderItem OrderPlace
Book1 CA
Book2 NY
Book3 FL
OrderDate
01/02/2014
Orderby
James
Mike
And I would like to create a text file that includes above result from a sp using C#. How can I do this?
Posted Mar 19, 2014, 1:45 AM
Using file stream and stream writer class you can get your thing you want
For Example:
suppose your results are in a table named DT, use loop like(foreach or for) to gets row values and write that values into file using stream writer. See below code
kindly mark as answer, if it solves your problem