web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Invalid 'where' condition. An entity member is invoking an invalid property or method.

(0) ShareShare
ReportReport
Posted on by

Hello guys,

I need to do a SELECT in Linq C#, but don't work. My code:

                var name = "aa"

                var listAccounts = (from i in contexto.ContextoServico.AccountSet
                                    where 
                                    name.ToUpper().Contains(i.ojc_name.ToUpper())
                                    orderby i.ojc_name ascending
                                    select i).Take(10).ToList();


Can you help me ?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Invalid 'where' condition. An entity member is invoking an invalid property or method.

    Hi Mahadeo,

    Thank you very much for answer ...

    I solved maked it:

    var listAccounts = (from i in contexto.ContextoServico.AccountSet

                                       where (i.StateCode == AccountState.Active && (i.ojc_name.Contains(nome.ToLower()) || i.ojc_accountnumber.Contains(nome)))

                                       orderby i.ojc_name ascending

                                       select i).Take(qtd.Value).ToList();

    We can'not to set ToUpper() in the property field of CRM. Only in variable of parameter.

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at
    RE: Invalid 'where' condition. An entity member is invoking an invalid property or method.

    Hi..

    i think you need to change query like

     var name = "aa"

                   var listAccounts = (from i in contexto.ContextoServico.AccountSet

                                       where

                                       i.ojc_name.ToUpper().Contains(name.ToUpper())

                                       orderby i.ojc_name ascending

                                       select i).Take(10).ToList();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans