Monday, March 12, 2012

How to copy a complex query result into a csv in file system

hi

How to copy a complex query result into a csv in file system

Regards

Rajesh

exuberantleon@dotnet.itags.org.yahoo.co.in

You didn't give much details. A way would be:

-Create a text file with csv extension.

-ExecuteReader()

-Write column names on first line separated by commas

while ( reader.Read() )

{

// Write row data, fields separated by commas and " as string delimiter. Each row ends with a CRLF pair

}


It depends on source of the data. In a case of SQL Server, you could write SQL DTS job that does it for you. If you have data in a DataSet, then you could use method described in CetinBasoz post or transform DataSet's XML into CSV using XSL

Labels: , , , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home