sudheshna
sudheshna

Reputation: 1150

Export table rows directly to a csv file using asp.net C#

How do I export result of a sql query to a csv file without mapping to an object. Is there a direct way for this?

Upvotes: 2

Views: 2544

Answers (2)

Pankaj
Pankaj

Reputation: 4505

You can directly handle this situation in data base.I mean directly import data into csv else you handle in code.

Upvotes: 0

gor
gor

Reputation: 11658

Retrieve data from database using IDataReader, and in a loop write all it's fields to csv file.

Also you can use csvhelper to write csv.

Upvotes: 1

Related Questions