Grab Datatables column Name in C#

Here is the code to grab the column name from the datatable and push it or recreate the same columns in another datatable.

foreach(DataColumn dc in objDatatable .Columns )
{

 dtNew.Columns.Add(dc.ColumnName; 
} 
  
  
Cheers, 
Venkatesan Prabu .J 
Head, kaaShiv InfoTech
Ebook Download
View all
Learn
View all