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

  • Home
  • SEARCH
  • 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 103809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:10:57+00:00 2026-05-11T01:10:57+00:00

I am finishing off a C# ASP.NET program that allows the user to build

  • 0

I am finishing off a C# ASP.NET program that allows the user to build their own computer by selecting hardware components such as memory, cpu, etc from a drop down lists. The SQL datatable has 3 columns; ComputerID, Attribute and Value. The computerID is an ID that corresponds to a certain computer in my main datatable of products, the Attribtute is the name of the hardware component; memory,cpu, hard drive etc.. and the value is the value assigned to that attribute, such as 1GB or 2.8GHz 320GB. This means that a computer will have multiple attributes.

What I am trying to do it narrow down the results by first selecting all computers that meet the first attribute requirements and then getting from that list, all computers that meet the next requirement.. and so on for about 10+ attributes.

I thought it might be a good idea to show you an example of my LINQ to SQL query so that you have a btter idea of what I am trying to do. This basically selects the ComputerID where the the computers memory is larger than 1GB.

var resultsList = from results in db.ComputerAttributes                   where computer.Value == 'MEMORY' && computer.Value >= '1'                   select results.ComputerID; 

Next I want to select from the resultsList where the CPU is say, faster than 2.8Ghz and so on.

I hope I have given you enough information. If anyone could please give me some advice as to how I might go about finishing this project that would be great.

Thanks

  • 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. 2026-05-11T01:10:57+00:00Added an answer on May 11, 2026 at 1:10 am

    You need to use Concat as a ‘Union All’.

    IQueryable<ComputerAttribute> results = null; foreach(ComputerRequirement z in requirements) {   //must assign to a locally scoped variable to avoid using   //  the same reference in all of the where methods.   ComputerRequirement cr = z;   if (results == null)   {     results = db.ComputerAttributes       .Where(c => c.Attribute == cr.Attribute && c.Value >= cr.Value);   }   else   {     results = results       .Concat(db.ComputerAttributes          .Where(c => c.Attribute == cr.Attribute && c.Value >= cr.Value)       );   } }  int requirementCount = requirements.Count();  //Get the id's of computers that matched all requirements. IQueryable<int> ids = results   .GroupBy(x => x.ComputerId)   .Where(g => g.Count == requirementsCount)   .Select(g => g.Key);   //Get all attributes for those id's List<ComputerAttributes> data = db   .ComputerAttributes.Where(c => ids.Contains(c.ComputerId))   .ToList(); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 86k
  • Answers 86k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You haven't told us how the fields in table3 are… May 11, 2026 at 5:18 pm
  • Editorial Team
    Editorial Team added an answer What are you looking for? Automatic type inference or looking… May 11, 2026 at 5:18 pm
  • Editorial Team
    Editorial Team added an answer This happened because my language setting was 'en-US' and not… May 11, 2026 at 5:18 pm

Related Questions

I am finishing up a Drupal site and I have attached a word document
I have been working with Struts for some time, but for a project I
I am just finishing up an Artificial Intelligence course where, as part of the
I am just putting some finishing touches onto a Licensing solution for a Web

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.