Generate a new  datatable from existing datable

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

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Officer
Most Valuable Expert 2011
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.


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