複製 DataTable – Clone / ImportRow 使用方法

 

   複製 DataTable – Clone / ImportRow 使用方法
 
   private DataTable copydata(DataTable SourceDataTable)
   {
 
      DataTable DestinationDataTable = SourceDataTable.Clone();
 
      for (int i = 0; i < SourceDataTable.Rows.Count – 1; i++)
      {
         DestinationDataTable.ImportRow(SourceDataTable.Rows[i]);
      }
 
      return DestinationDataTable;
 
   }