2

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?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Is this looping will cause any performance issue as I will have more than 3000 records each time
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.