i want to copy data of datatable1 to datatable2 using for loop.How can i do this?
Visual Basic.NET.NET Programming
Last Comment
Vijay Kamble
8/22/2022 - Mon
kaufmed
If the For loop mandatory? There is the Copy method which you could use.
Dim dt1 As New DataTable()Dim dt2 As New DataTable()dt1.Columns.Add("col1", GetType(Integer))dt1.Columns.Add("col2", GetType(String))dt1.Rows.Add(1, "Red")dt1.Rows.Add(2, "Blue")dt1.Rows.Add(3, "Green")dt2 = dt1.Copy()
Open in new window