Generate a new  datatable from existing datable

RIAS
RIAS used Ask the Experts™
on
How to query or just get few columns a existing datatable to generate a new datatable of the result set.

Regards
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Officer
Most Valuable Expert 2011
Commented:
Since DataTable implements IQueryable, you can filter it which is like running a query on existing table or view.  You then have the option to store those query results in a new table.  That is all you are doing here in code so .NET has a nice way to do that via LINQ.  Obviously, you also can loop the rows of table and manually add to a new table if you don’t want to use LINQ.

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/creating-a-datatable-from-a-query-linq-to-dataset

Author

Commented:
Thanks a lot, will do so.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial