|
-
Feb 22nd, 2004, 12:16 PM
#1
Thread Starter
Lively Member
Copy Data Table .... any more efficient way ?
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|