Click here to Skip to main content
15,914,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I attended a problem in my application ,now I would like to display the database(table) values to the display text file or the document but I dont know how to display the database fields in text file any one can help me?

I used SQL server2005.
Posted
Updated 6-Jul-10 3:10am
v5
Comments
Dalek Dave 1-Jul-10 19:48pm    
edited for readability

1 solution

Use 2 loops, the first loop traverses the rows in the datatable, the second loop traverses the columns in each row.

Use a stringbuilder to create a string with column name a space or tab and the column value for each row.

Use a steamwriter to output the text to a file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900