title: Fetch Data from database and export it to a .csv file
body: <p>I am trying to fetch data from database and export it to <code>.csv</code> file format, which is similar to <code>ETL process</code>.  But I want to do this in <code>C#</code>.  </p>
  
  <ol>
  <li>SQL Query to fetch data from database.</li>
  <li>Format the data to a specified file specification.</li>
  <li>Convert it to .csv file.</li>
  </ol>
  
  <p>I know that 1st step is easy to do, I am struggling to find a way for 2nd and 3rd step. </p>