Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1299
  • Last Modified:

Copy data from datagridview to datatable

I have a datagridview on a form that is populated from a datatable in dataset1. I want to take all that data and copy to an identical datatable in dataset2.
0
wiswalld
Asked:
wiswalld
  • 2
1 Solution
 
brenkehoe777Commented:
This should work
DataTable dt = new DataTable();
                dt = ds1.Tables[0];
                DataSet ds2 = new DataSet();
                ds.Tables.Add(dt);

Open in new window

0
 
brenkehoe777Commented:
In vb.net
Dim dt As New DataTable()
dt = ds1.Tables(0)
Dim ds2 As New DataSet()
ds.Tables.Add(dt)

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now