Home > Code > C# > How to copy all rows from Datarow to DataTable in C#?

How to copy all rows from Datarow to DataTable in C#?

by Thamil   on Aug 28, 2013   Category: C#   |  Views: 3881    |  Points: 25   |  Gold 



Sometime we may need to copy all rows from data row to datatable, in this case use below simple c# code to achieve this.

DataRow[] dtRow = dtCourse.Select();//Select records from Datatable and load into DataRow
DataTable Newdt = dtRow.CopyToDataTable<DataRow>(); // CopyToDataTable, returns the datatbale that contains the copy of datarow objects.





Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts