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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:10:20+00:00 2026-05-30T00:10:20+00:00

I am trying to implement the Like operator by using the entity framework query.

  • 0

I am trying to implement the Like operator by using the entity framework query. But it seems Like doesn’t appear to be supported on an int column.

Here is my query:

using (ObjectContext ctx = new ObjectContext(gbcDbConnection.eObjqueryConnection))
{
    string result = " Select ";
    result += "       master_factory.FACTORY_ID, master_factory.FACTORY_NAME,  ";
    result += "       case when master_factory.FACTORY_TYPE ='"  
           + gbvArticleVarieble.FactoryTypeExterIni+"' then '" 
           + gbvArticleVarieble.FactoryTypeExter+"' else '" 
           + gbvArticleVarieble.FactoryTypeInter+"' end as factory_type ";

    result += " FROM  ";
    result += "     LEWREDBEntities.[MASTER_FACTORY] as master_factory  ";


    result += " WHERE ";
    result += "      (master_factory.FACTORY_TYPE = @factoryType1 or master_factory.FACTORY_TYPE =@factoryType2) and master_factory.STATUS<>@status";


    if (searchVal != "")
    {
         result += "      AND master_factory.[FACTORY_ID]  LIKE '%' + @searchVal + '%' ";
    }



    ObjectQuery<DbDataRecord> query = ctx.CreateQuery<DbDataRecord>(result);
    query.Parameters.Add(new ObjectParameter("status", gbcDBVariable.DeleteIni));
    query.Parameters.Add(new ObjectParameter("factoryType1",gbvArticleVarieble.FactoryTypeExterIni ));
    query.Parameters.Add(new ObjectParameter("factoryType2", gbvArticleVarieble.FactoryTypeInterIni));
    if (searchVal != "")
    {
        query.Parameters.Add(new ObjectParameter("searchValue", searchVal));

    }
    if (logger.IsDebugEnabled)
    {
        query.ToTraceString();
    }

As you see, the Factory id is integer data type. When I execute it, it returns an error:

LIKE arguments must be of string type. Near member access expression

Did anyone else try this before?

  • 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-05-30T00:10:21+00:00Added an answer on May 30, 2026 at 12:10 am

    You can probably use CAST, I’m not familiar with ESQL but:

    AND CAST(master_factory.[FACTORY_ID] as System.String) LIKE ‘%’ + @searchVal + ‘%’

    This link gets all mushy:
    How to String Concatenation in Entity SQL?

    this is more formal:
    http://msdn.microsoft.com/en-us/library/bb399172.aspx

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement the repository pattern using a generic repository like the one
I'm trying to implement a WPF application using MVVM (Model-View-ViewModel) pattern and I'd like
I am trying to implement full text search using Quartz 2D but it's a
I'm trying to implement urls like the one below: www.example.com/contact-us ,but with one exception,
I'm trying to implement something like this: <div> <table> <thead> <tr> <td>Port name</td> <td>Current
I'm trying to implement a tab menu just like the one in Stack Overflow.
I am trying to implement a similar feature like the autosuggest feature for tags
I'm trying to implement my custom authorize attribute like: public class MyCustomAuth : AuthorizeAttribute
I'm kind of like stuck trying to implement YUI autocomplete textbox. here's the code:
I'm trying to implement this pattern in my WinForms application (I don't like it,

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.