Shared Function CopyRowValues(ByVal SourceRow As DataRow, ByVal TargetRow As DataRow) As Integer
Dim SR As DataRow = SourceRow
Dim TR As DataRow = TargetRow
Dim ST As DataTable = SR.Table
Dim TT As DataTable = TR.Table
Dim SC As DataColumn
Dim TC As DataColumn
Dim Copied As Integer
For Each SC In ST.Columns
TC = TT.Columns(SC.ColumnName)
If Not TC Is Nothing AndAlso Not TC.ReadOnly Then
If TC.DataType.GetType Is SC.DataType.GetType Then
Try
TR(TC) = SR(SC)
Copied += 1
Catch oEx As Exception
End Try
End If
End If
Next
Return Copied
End Function
|