• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3196
  • Last Modified:

C# code to create CSV file with SQL resultant output

Hello Experts,

I want to know how to create CSV file from table data present in dataset/datatable via C# code.

Any URL's or sample demo code which help me in understanding will be helpfull.

Thank You !!
Md Shah
Md Shah
2 Solutions
Éric MoreauSenior .Net ConsultantCommented:
Utkarsh KulkarniSr. Sw EngCommented:
Another way to do is bind this data to Grid & save that grid to CSV file. Sample code ref is


Simple workout is like


This will give you clear idea.
Md ShahAuthor Commented:
Thanks guys for sharing the info... It works...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now