Create a datatable from a datatable

M

Marc

Hi

using vbnet
is it possible to create a datatable from another datatable using a select
query


So i have a datatable1 with all data

I need to create from datatable1 a new datatable2 select on datatable1

each datatable need to fill a datagridview



manny thanks in advance
Marc
 
K

Kerry Moorman

Marc,

Get the rows you need in a dataview and then use the dataview's ToTable
method to create a new datatable from the rows in the dataview.

Kerry Moorman
 
C

Cor Ligthert[MVP]

Marc,

Not with the select, that creates an array of datarows, however why would
you, you have two other possibilities.

the datatable.Clone (but probably you want a selection and then)

Use the dataview.ToTable(with a lot of overloaded possibilities to (in
versions after 2003) exactly select what you need)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top