title: serialize datatable to a binary file , then add new rows to file
body: <p>Problem :</p>
  
  <p>I need to save a datatable to a binary file , in binary format , in order to make the process fast because the datatable may contain up ten millions rows. So , XML is not favorable because it makes the file large sized , and the process will be slow.
  I managed to save the datatable to a binary file , and it works fine , but the problem when I try to add new rows to the existing binary file (using a datatable with the same schema , but different rows data) , it copies the schema of the datatable to the binary file , making it very large.</p>
  
  <p>What is needed:</p>
  
  <p>I need to be able to only add rows to the existing binary file. If you try the below code and run it 3 times , it should create the binary file and then add 5 rows for each save , ie , save 15 rows . But this is not the case. it will save table schema &amp; 5 rows (in binary format) >>> then table schema &amp; 5 rows (in binary format) >>>table schema &amp; 5 rows (in binary format). Table schema itself is very large , and consumes much file size. I need to save the file schema only once , then the 15 rows.</p>
  
  <p>My Code:
       Function GetTable() As DataTable</p>
  
  <pre><code>Dim table As New DataTable ' Create new DataTable instance.
  
  table.Columns.Add("Dosage", GetType(Integer)) ' Create four typed columns in the DataTable.
  table.Columns.Add("Drug", GetType(String))
  table.Columns.Add("Patient", GetType(String))
  table.Columns.Add("Date", GetType(DateTime))
  ' Add five rows with those columns filled in the DataTable.
  table.Rows.Add(25, "Indocin", "David", DateTime.Now)
  table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now)
  table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now)
  table.Rows.Add(21, "Combivent", "Janet", DateTime.Now)
  table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now)
  Return table
  End Function
  
  Private Sub SaveDataTabletoBinary()
  dt = GetTable()
  
  Dim format As New Binary.BinaryFormatter
  Dim ds As New DataSet
  ' ds = DataGridView1.DataSource
  
  Using fs As New FileStream("c:\sar1.txt", FileMode.Append)
  dt.RemotingFormat = SerializationFormat.Binary
  
  'Other option is SerilaizationFormat.XML 
  format.Serialize(fs, ds)
  End Using
  End Sub
  </code></pre>
  
  <p>Any Idea. ?</p>
  
  <p>Thanks </p>