Good day.

I have a situation like this: I have a source datatable, which will be copied to a destination datatable, based on column mapping using arrays.

Codes are like below:

'datSource = Source datatable
'datDes = Destination datatable
'aryMapping (source-column-index) = dest-column-index)

With datSource
For intX = 0 To .Rows.Count - 1
objRow = .Rows(intX)
objNewRow = datDes.NewRow

For intY = 0 To .Columns.Count - 1
objNewRow.Item(aryMapping(intY)) = objRow.Item(intY)
Next

datDes.Rows.Add(objNewRow)
Next
End With

This works fine but it raises some performance issue. Is there any more efficient way of doing that ? I tried to use the COPY method in datatable but it copy the whole data and structure of the datatable. Btw, teh source and destiantion datatable come from different data sources.

Thanks.

SonicWave