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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:22:48+00:00 2026-06-08T19:22:48+00:00

I have entity framework code as shown below.I am getting following error in where

  • 0

I have entity framework code as shown below.I am getting following error in where condition.

Cannot convert lambda expression to type ‘bool’ because it is not a delegate type

How to overcome this error? What is the reason for this error?

    static void Main(string[] args)
    {

        ClubCreation();
        List<Club> selectedClubs = GetClubs("club1");

    }

    public static void ClubCreation()
    {

        string connectionstring = "Data Source=.;Initial Catalog=NerdDinners;Integrated Security=True;Connect Timeout=30";
        using (var db = new NerdDinners(connectionstring))
        {

            Club club1 = new Club();
            club1.ClubName = "club1";

            Club club2 = new Club();
            club2.ClubName = "club2";

            Club club3 = new Club();
            club3.ClubName = "club3";

            db.Clubs.Add(club1);
            db.Clubs.Add(club2);
            db.Clubs.Add(club3);

            int recordsAffected = db.SaveChanges();


        }
    }

    public static List<Club> GetClubs(string clubName)
    {
        string connectionstring = "Data Source=.;Initial Catalog=NerdDinners;Integrated Security=True;Connect Timeout=30";
        using (var db = new NerdDinners(connectionstring))
        {

            Club club1 = new Club();
            Club club2 = new Club();
            Club club3 = new Club();


            var query = from o in db.Clubs
                        where (p => p.ClubName == "club1")
                        select o;

            return query.ToList();





        }
    }
  • 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-08T19:22:51+00:00Added an answer on June 8, 2026 at 7:22 pm

    Instead of where (p => p.ClubName == "club1") use:

    var query = from o in db.Clubs
                where  o.ClubName == "club1"
                select o;
    

    May be you are confused with method chaining where it would be:

    var query = db.Clubs.Where(p => p.ClubName == "club1");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error when generate Database from Entity Framework Code First. I
I have several Entity Framework Code First DbContext objects that use a custom Initializer.
I have an issue in entity framework code first, three table in database as
I am Using C# 2010 Entity framework code first If I have A class
I'm using Entity Framework Code First v 4.3.0 I have a two entities with
I have a very simple query: The variable '_dc' is the Entity Framework Code
I have an Entity in Code First Entity framework that currently looks like this:
I have a simple code in Entity Framework (EF) v4.1 code first: PasmISOContext db
I am using Entity Framework 5 RC and i have some code that require
Background We have a WinForms application with Entity Framework 4.2 code-first / FluentAPI using

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.