Link to home
Start Free TrialLog in
Avatar of Vijay Kamble
Vijay KambleFlag for India

asked on

Multiple datatables in vb.net 2010

i want to copy data of datatable1 to datatable2 using for loop.How can i do this?
Avatar of kaufmed
kaufmed
Flag of United States of America image

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

Avatar of Vijay Kamble

ASKER

Yes for loop is mandatory because i want to change data in datatable1 in some specific rows.so tell me how can i do this?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
its done thank you