title: Upload / Download file from SQL Server 2005/2008 from WinForms C# app?
body: <p>I'm using DocX to create .docx files. Instead of storing them on hard drive, Share or SharePoint i would prefer to store them inside SQL Database. So my questions are:</p>
  
  <ol>
  <li>How to write proper code to save file to that database? </li>
  <li>How to write proper code to retrive file to that database?</li>
  <li>What kind of datatype should i set for a table to hold the docx files? Is it Image?</li>
  </ol>
  
  <p>With regards,</p>
  
  <p>MadBoy</p>
  
  <p>PS. I would prefer a proper code in terms of using Using the old 'school' way:</p>
  
  <pre><code>using (var varConnection = Locale.sqlConnectOneTime(Locale.sqlDataConnectionDetailsDepozyt))
  using (var sqlQuery = new SqlCommand(preparedCommand, varConnection))
  using (var sqlQueryResult = sqlQuery.ExecuteReader())
      while (sqlQueryResult != null &amp;&amp; sqlQueryResult.Read())
  </code></pre>