Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7859397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:54:03+00:00 2026-06-02T21:54:03+00:00

I have big DataTable I want to get subset of this DataTable represented as

  • 0

I have big DataTable I want to get subset of this DataTable represented as DataTable either.
Briefly saying how do I select particular columns in DataTable.

I was trying something like this but it doesn’t work…

DataTable dTable = new DataTable();
...
...
...
        DataTable dt = from field in dTable
                       where field.Field<string>("Manager")
                       where field.Field<string>("Phone")
                       select field;

Maybe my code is wrong, how do I get “managers” and “Phone” columns from one DataTable to another without looping thought it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:54:04+00:00Added an answer on June 2, 2026 at 9:54 pm

    Reference the DataTableExtensions –

    http://msdn.microsoft.com/en-us/library/system.data.datatableextensions.asenumerable.aspx

    Then…

    var whatever = dTable.AsEnumerable();
    

    Then per the MSDN example…

    var productNames = from products in table.AsEnumerable() 
          select products.Field<string>("ProductName");
    

    Edit/update: Unfortunately I do not think there is a built in direct cast back to a DataTable with a different schema. You have to use a DataTable? I believe it… as it might be too much effort to refactor and test your code. Good luck and keep us posted as working with strongly-typed lists are much more fun.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JQuery with the DataTable plugin, and now I have a big
I have big problem when I am trying to deploy my app over clickonce.
I have big set of urls and I want to implement an autocompletion. I
I have this data which can be very big in size, this could be
I have big process running. It spawns two threads. I want to debug those
i have big table with many html items such as select, textbox, radio-button, checkbox.
I have big xls file with formulas and graphics. I want to add some
I have some very big DataTable s, which I need to see their content
I have big problem with my small database(DERBY) application. I am getting such an
I have big issue with url-rewriting for IIS 7.0. I've written simple module for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.