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 325915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:15:40+00:00 2026-05-12T09:15:40+00:00

First I have to say, that I am a newby using LINQ. Actually I

  • 0

First I have to say, that I am a newby using LINQ. Actually I never used before, but I am having a task where I need to filter a DataTable, using values that will come from a List.
So I will like to know if it’s possible in LINQ to query on a Datatable using values in the List as Filter values. Some one can give me some hint’s

Thank you.

  • 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-05-12T09:15:40+00:00Added an answer on May 12, 2026 at 9:15 am

    The best way to do this depends on what you plan to do with the filtered results. Do you need the results back as DataTable for further operations, or are you databinding to the results?

    Take the example below, which returns a (bindable) enumerator of matching DataRows

    //create sample table with sample rows
    DataTable table = new DataTable();
    
    table.Columns.Add("id", typeof(int));
    
    for (int i = 1; i < 11; i++)
    {
        DataRow row = table.NewRow();
        row[0] = i;
        table.Rows.Add(row);
    }
    
    //filter the table by id (in a list)
    List<int> rowIds = new List<int> { 1, 3, 6 };
    
    IEnumerable<DataRow> matchingRows = from DataRow row in table.Rows
                       where rowIds.Contains((int)row[0])
                       select row;
    

    If you need a DataTable you could import the rows into another table:

    DataTable filteredTable = table.Clone();
    
    foreach (DataRow filteredRow in matchingRows)
    {
        filteredTable.ImportRow(filteredRow);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note : I have tried using unserialize function but it say that first argument
I have to say that i'm using this android device for the first time,
First of all, I have to say that I'm going to talk about System.ComponentModel.Component
At first, i have to say that this topic is very common topic. I
First of all i want to say that i have searched each and every
First off I should say that I don't have any experience in working with
First, let me just say that I have searched for information on this topic;
Let's say I have a form that collects a first name and a last
First let me say I have read this useful article thoroughly and am using
I have a Problem developing in PHP. First I have to say that I'm

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.