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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:07:41+00:00 2026-06-18T17:07:41+00:00

Basically, the idea is to match data from one DataTable with another. In the

  • 0

Basically, the idea is to match data from one DataTable with another.
In the first DT, there are 20 different columns in one row that I create an array from, and there is another DT with thousands of rows, two columns each. I need to select all of those rows in the second DT that are found among all of the 20 different variables in the array (so, I go row by row in the first table).

Can I do this in one query?

for (int x = 0; x < 20; x++) //this fills up the array from the 20 columns of dt1
{
   numbers[x] = Convert.ToInt16(dt1.Rows[i]["n" + (x+1)]);
}
var filtered = dt2.Select("Col1 = " + (any of the numbers[]) + " AND Col2 = " + (any of the numbers[]));

So clearly the line in question is the last one. I’m not sure if it’s possible to do so.

I’m new here and I’m new to C# as well.
Thank you for your help.

  • 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-18T17:07:42+00:00Added an answer on June 18, 2026 at 5:07 pm

    You could use this SQL on DataTable:

    var numbersAsString = numbers.Select(x => x.ToString()).Aggregate((x,y) => x + "," + y);
    var filtered = dt2.Select("Col1 in (" + numbersAsString  + ") AND Col2 in (" + numbersAsString  + ")");
    

    First you create string from your Array that looks like this: ‘1,3,4,5’ and then checks in SQL if Col1 or Col2 value is in the array.

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

Sidebar

Related Questions

How do I compare values of one data set from another. 1st dataset [proper
The idea is to create a DOM-like tree. But there are some restrictions, that
basically need to change the value that - admin_url() returns any idea?
Well basically, one of my mates was practicing JS and he had an idea
Since there is currently no universal way to read live data from an audio
I have this grand idea to basically employ some brute force attack to test/verify
Basically i want to do the below in .NET but i have no idea
Alright so I have no idea how to even begin doing this But basically
Basically, I have a UIImageView that will loop through 8 PNGs over 0.5 seconds.
I have a client that wants a custom importer. The data source is an

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.