How can we copy the data of the datacolumn of the datatable to another datatable ?
Posted
by Harikrishna
on Stack Overflow
See other posts from Stack Overflow
or by Harikrishna
Published on 2010-04-06T09:50:23Z
Indexed on
2010/04/06
9:53 UTC
Read the original article
Hit count: 493
How can we copy one datacolumn with data from one datatable to another datatable ? I have datatable like
DataTable datatable1=new DataTable();
and there are four columns in that table but I want only one column.So I am doing like
DataTable datatable2=new DataTable();
addressAndPhones2.Columns.Add(addressAndPhones.Columns[0].ColumnName,addressAndPhones.Columns[0].DataType,addressAndPhones.Columns[0].Expression);
but this just adds the column but I want to copy the data for that column to the datatable2.That is I want to copy the datacolumn with data from one datatable to another datatable.
© Stack Overflow or respective owner