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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:04:50+00:00 2026-06-07T16:04:50+00:00

Preamble: I’m trying to learn C#/LINQ by creating a new application from an existing

  • 0

Preamble:

I’m trying to learn C#/LINQ by creating a new application from an existing program. Essentially, I’m porting SQL stored procedures to C#/LINQ code with a new database and slightly different functionality. Although I’ve had assistance with getting going I’ve ran into my first what some might say trivial problem.

Although any correct answer would be very much appreciated so would direction. (e.g. is it just a query with simply a Group Into clause? have I missed a similar question in stackoverflow? I have lots of learning tools at my disposal thanks to browsing stackoverflow for a number of months, 101 LINQ Samples, C# In Depth, C# 4.0 in a Nutshell and LINQPad. The information is great, it’s just that I’m a bit overwhelmed by it.

Question:

I have the following table:

CREATE TABLE [dbo].[User]
([Id] [nvarchar](255) NOT NULL,
 [Name] [nvarchar](max) NOT NULL,
 [LineManagerId] [nvarchar](255) NULL,
 [Email] [nvarchar](max) NOT NULL,
 [IsAdmin] [bit] NULL,
)

The primary key is Id, the LineManagerId is a foreign key of Id.

I would like to would like to write LINQ code to query the database to find if an Id is a LineManagerId AND if so select all the Ids that that LineMangerId has?

I’ve had an attempt as follows but am missing some what I reckon are very basic skills in my understanding of LINQ.

var ismanager = from manager in Users
                join man in Users on manager.Id equals man.LineManagerId
                select man.LineManagerId;   

Thanks for reading.

  • 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-07T16:04:52+00:00Added an answer on June 7, 2026 at 4:04 pm

    I would like to would like to write LINQ code to query the database to find if an Id is a LineManagerId AND if so select all the Ids that that LineMangerId has?

    Taken literally that’s two separate queries, but here’s one that will give you all of the users under a line manager:

    string managerID = "1";  // The manager ID to query
    var userList = from manager in Users
       join u in Users on manager.Id equals u.LineManagerId
       where (manager.Id == managerID)
       select u.Id ;  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Preamble: I'm creating some tables in SQL Server that will be accessed via Linq-to-entities
Without any preamble I want to show you problem I have in my program,
How to set the font generated from a beamer latex file to Times New
Preamble As a part of a project I'm working on I am trying to
I've got Python code with a preamble containing the line: from numpy import array,arccosh,random_integers
Preamble: I am using ASP.NET 3.5 and AJAXControlToolkit. I am trying to use the
Preamble To build dynamic web-sites, we have to master at least four languages: HTML
Small preamble. I was good java developer on 1.4 jdk. After it I have
In the spirit of the Perl Preamble where a script works properly whether executed
Preamble: I know, disabling warnings is not a good idea. Anyway, I have a

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.