Avatar of Vijay Kamble
Vijay Kamble
Flag 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?
Visual Basic.NET.NET Programming

Avatar of undefined
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

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
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Vijay Kamble

ASKER
its done thank you
Your help has saved me hundreds of hours of internet surfing.
fblack61