title: C# SQLServer retrieving results and place in a .csv format
body: <p>I had a look on the site and on Google, but I couldn't seem to find a good solution to what I'm trying to do.</p>
  
  <p>Basically, I have a client server application (C#) where I send the server an SQL select statement (Connecting to SQL Server 2008) and would like to return results in a CSV manner back to the client.</p>
  
  <p>So far I have the following:</p>
  
  <pre><code>if (sqlDataReader.HasRows)
  {
      while(sqlDataReader.Read())
      {
         //not really sure what to put here and if the while should be there!
      }
  </code></pre>
  
  <p>}
  `</p>
  
  <p>Unfortunately, I'm really new to connecting C# with SQL. I need any tips on how to simply put the results in a string in a csv format. The columns and fields are likely to be different so I cannot use the method of something[something] as I've seen in a few sites. I'm not sure if I'm being comprehensible tbh!</p>
  
  <p>I would really appreciate any tips / points on how to go about this please!</p>