Copying fix no of columns data from one tabel to another table.-DataTable.
Posted
by Harikrishna
on Stack Overflow
See other posts from Stack Overflow
or by Harikrishna
Published on 2010-04-06T06:23:48Z
Indexed on
2010/04/06
6:33 UTC
Read the original article
Hit count: 183
I have one Datatable like
DataTable addressAndPhones;
And there are four columns name,address,phoneno,and other details and I only want two columns Name and address from that so I do for that is
DataTable addressAndPhones2;
addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["name"].ColumnName));
addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["address"].ColumnName));
But it gives me error so how can I copy fix no of columns data from one table to another table ?
ERROR :Object reference not set to an instance of an object.
© Stack Overflow or respective owner