Copy a Subset of Datatable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I created a datatable (dt1) of 3 columns A, B, C, and I want to copy this
datatable into another datatable (dt2) but without the column B. How to do
this?

Thanks in advance
 
Li said:
Hi,

I created a datatable (dt1) of 3 columns A, B, C, and I want to copy this
datatable into another datatable (dt2) but without the column B. How to do
this?

Thanks in advance

For Each R as DataRow in dt1
Dim R2 as DataRow = Dt2.NewRow
R2(0) = R(0)
R2(1) = R(2)
R2(2) = R(3)
dt2.Rows.Add(r2)
Next

Out of curiousity, why do you want to do this? It seems that there are
probably better ways of doing what you need in the end than doubling the
data.

Chris
 
Thanks Chris,

R2(2) = R(3) should be excluded. I just want to bind them to different
controls.
 

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

Back
Top