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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:40:03+00:00 2026-05-11T05:40:03+00:00

I have a very big problem solving this issue I have 2 tables first

  • 0

I have a very big problem solving this issue I have 2 tables

first table is : http://lh3.ggpht.com/_uMvfbnPHuko/SYPJQ1ZsBDI/AAAAAAAAAKs/eq49xquy3jM/s800/Untitled-2.jpg

which contains a modules (id and name)

second table is http://lh6.ggpht.com/_uMvfbnPHuko/SYPJQ4IXGwI/AAAAAAAAAK0/zmTIO6V-UEQ/s800/Untitled-3.jpg

which contains users ids and their preferred modules’ numbers

now lets move to the problem I want to generate a list of checkboxes

for example for the userid 1 which has the following modules ‘3,2 and 4’ the result will be

http://lh4.ggpht.com/_uMvfbnPHuko/SYPJQ_LJeVI/AAAAAAAAAK8/6RV8a1S8eCY/s800/Untitled-4.jpg

notice that ‘recommended for you’ checkbox is not checked because the user 1 does not have module id ‘1’

I spent a long time trying to solve this problem using c# and LINQ

see the result of my effort 🙂 (the following code does not work)

    var q = from m in db.modules             from um in db.usersModules.Where(um2 => um2.userId == myUserId).Single().modules.Trim().Split(',')             where um.Contains(m.moduleId.ToString())             select new             {                 moduleid = here i want the module id from modules table                 modulename = here i want the modulename from modules table                 ischecked = here i want 'true' or 'false' depending on if the user has this module or not              }; 

If LINQ is easy for you please try to solve this one? any questions?

  • 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-11T05:40:03+00:00Added an answer on May 11, 2026 at 5:40 am

    Your query doesn’t works because LinqToSQL tries to translate everything to plain SQL.

    If you cannot refactor your schema, and use an intermediate table since you clearly have a many-to-many relation ship, you can do something like this:

    var userModules = db.userModules.SingleOrDefault(m => m.userId == myUserId).modules; // Get the modules of the user (a comma delimited string) var integerModules = modules.Split(',').Select(m => int.Parse(m)); // Convert the comma delimited string to IEnumerable<int>  var query = db.modules.Select(x => new {                 x.moduleId,                 x.moduleName,                 isChecked = integerModules.Contains(x.moduleId) }); // And finally do the query 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • 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 could use the "XmlDocument.CreateCDataSection(string)" method. First search each text… May 12, 2026 at 12:50 am
  • Editorial Team
    Editorial Team added an answer You should be able to change the "Product Name" in… May 12, 2026 at 12:50 am
  • Editorial Team
    Editorial Team added an answer The subversion code which raises that error can be inspected… May 12, 2026 at 12:50 am

Related Questions

I have this home work where I have to transfer a very big file
I'm solving problems in Project Euler . Most of the problems solved by big
I have a very big problem. I am making a CRM (Costumer Relationship Management)
Essentially, I have a very large List containing in turn relatively large Dictionaries. So

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.