Copying columns from one DataTable to another DataTable
-
Hi, I have two datatables each table contain one column. I want to make a new data table that should contain both columns. Can u plz tell me how can I do this in c#.net. I will be thankful to you, Regards,
-
Hi, I have two datatables each table contain one column. I want to make a new data table that should contain both columns. Can u plz tell me how can I do this in c#.net. I will be thankful to you, Regards,
dt2.Columns.Add ( dt1.Columns [ 0 ].ColumnName , dt1.Columns [ 0 ].DataType ) ;
Will create a column with the same name and type, but you'll have to iterate the rows to copy the data. -
dt2.Columns.Add ( dt1.Columns [ 0 ].ColumnName , dt1.Columns [ 0 ].DataType ) ;
Will create a column with the same name and type, but you'll have to iterate the rows to copy the data.thanks a lot for ur reply, plz tell me is there any way to copy the data without iteration. actually i want to copy the whole column in another datatable. thanks,