plz help,
i want to copy some specific rows record from old datatable and add in new datatable as it is.
Thanks in advance........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
DA DPosted Mar 23, 2012, 12:31 AM
i want to copy data in new datatable dynamically with rows and col. just like as selected specific row copy from old datatable & paste in to new datatable.
thanks to u again....
Gohil JayendrasinhPosted Mar 22, 2012, 7:22 AM
DataTable dt = new DataTable();
//Create Datatable with column you need.
var info = (from a in dtOld.AsEnumerable()
select new
{
// select columen you need
}
)
if (info != null)
{
if (info.Count() > 0)
{
dt = info.CopyToDataTable();
}
}
VulpesPosted Mar 22, 2012, 5:39 AM
http://msdn.microsoft.com/en-us/library/system.data.datatable.importrow.aspx
http://www.c-sharpcorner.com/UploadFile/mahesh/ImportRow07092006195427PM/ImportRow.aspx