Bulk Copy (fast db insert)

      // define DataTable
      DataTable table = new DataTable("TableName");
      table.Columns.Add(new DataColumn("FkId",typeof(int)));
      table.Columns.Add(new DataColumn("Value1", typeof(double)));
      table.Columns.Add(new DataColumn("Value2", typeof(double)));
 
      // fill the table
      for (int i = 0; i < Length; i++)
      {
         table.Rows.Add(FkId[i], Value1[i], Value2[i]);
      }
 
      // define mappings and use bulk copy
      using (var bulkCopy = new SqlBulkCopy(_connectionString))
      {
          bulkCopy.BulkCopyTimeout = 600; // in seconds
          bulkCopy.DestinationTableName = "TableName";
          bulkCopy.ColumnMappings.Add("FkId", "FkId");
          bulkCopy.ColumnMappings.Add("Value1", "Value1");
          bulkCopy.ColumnMappings.Add("Value2", "Value2");
          bulkCopy.WriteToServer(table);
      }