I want to convert a DataRow
array into DataTable
… What is the simplest way to do this?
C# – Simple way to convert datarow array to datatable
arrayscdatarowdatatable
Related Topic
- Java – What’s the simplest way to print a Java array
- Javascript – How to insert an item into an array at a specific index (JavaScript)
- Javascript – How to check if a variable is an array in JavaScript
- Javascript – How to remove a specific item from an array
- Javascript – Find object by id in an array of JavaScript objects
- Javascript – How to add new array elements at the beginning of an array in Javascript
- Javascript – For-each over an array in JavaScript
- Java – How to convert a Java 8 Stream to an Array
Best Answer
For .Net Framework 3.5+
But if there is no rows in the array, it can cause the errors such as The source contains no DataRows. Therefore, if you decide to use this method
CopyToDataTable()
, you should check the array to know it has datarows or not.Reference available at MSDN: DataTableExtensions.CopyToDataTable Method (IEnumerable)