Cerebrus
unread,Aug 29, 2009, 7:21:36 AM8/29/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hmmm... I found a little time to check it out and it turns out that I
was mistaken. Contrary to my initial assumption, ImportRow() does
actually *insert* the DataRow at the last index position in the Table.
I was probably confusing it with the way that the
XmlDocument.ImportNode() works.
So, the solution in your case will have to involve creation of a new
DataRow. What can be optimized however is the copying of individual
DataColumns. Here's a sample function I wrote to do this:
---
Private Sub ImportRows(ByVal srcTable As DataTable, ByVal tgtTable As
DataTable, ByVal insertPos As Integer)
For Each srcDR As DataRow In srcTable.Rows
Dim tgtDR As DataRow = tgtTable.NewRow()
tgtDR.ItemArray = srcDR.ItemArray
tgtTable.Rows.InsertAt(tgtDR, insertPos)
insertPos += 1
Next
End Sub
---
> > > Next- Hide quoted text -
>
> - Show quoted text -