title: How to export large SQL Server table into a CSV file using the FileHelpers library?
body: <p>I'm looking to export a large SQL Server table into a CSV file using C# and the FileHelpers library. 
  I could consider C# and bcp as well, but I thought FileHelpers would be more flexible than bcp. Speed is not a special requirement.
  <code>OutOfMemoryException</code> is thrown on the <code>storage.ExtractRecords()</code> when the below code is run (some less essential code has been omitted):</p>
  
  <pre><code>  SqlServerStorage storage = new SqlServerStorage(typeof(Order));
      storage.ServerName = "SqlServer"; 
      storage.DatabaseName = "SqlDataBase";
      storage.SelectSql = "select * from Orders";
      storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);
      Order[] output = null;
      output = storage.ExtractRecords() as Order[];
  </code></pre>
  
  <p>When the below code is run, 'Timeout expired' is thrown on the <code>link.ExtractToFile()</code>:</p>
  
  <pre><code> SqlServerStorage storage = new SqlServerStorage(typeof(Order));
      string sqlConnectionString = "Server=SqlServer;Database=SqlDataBase;Trusted_Connection=True";
      storage.ConnectionString = sqlConnectionString;
      storage.SelectSql = "select * from Orders";
      storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);
      FileDataLink link = new FileDataLink(storage);
      link.FileHelperEngine.HeaderText = headerLine;
      link.ExtractToFile("file.csv");
  </code></pre>
  
  <p>The SQL query run takes more than the default 30 sec and therefore the timeout exception. Unfortunately, I can't find in the FileHelpers docs how to set the SQL Command timeout to a higher value.</p>
  
  <p>I could consider to loop an SQL select on small data sets until the whole table gets exported, but the procedure would be too complicated.
  Is there a straightforward method to use FileHelpers on large DB tables export?</p>