Public Function CopyTable(ByVal DT As DataTable) As DataTable
Try
Dim DTn As DataTable
Dim i As Integer
If DTn Is Nothing Then
DTn = New DataTable
DTn = DT.Clone
DTn.TableName = DT.TableName
End If
For i = 0 To DT.Rows.Count - 1
DTn.ImportRow(DT.Rows(i))
Next i
Return DTn
Catch ex As System.Exception
Return Nothing
End Try
End Function
|