Link to home
Create AccountLog 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
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
its done thank you