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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:06:48+00:00 2026-05-11T12:06:48+00:00

Without the use of LIKE in Dynamic Linq it virtually renders it useless to

  • 0

Without the use of ‘LIKE’ in Dynamic Linq it virtually renders it useless to me when trying to create an advanced search query.

How have any of you overcome this Advanced Search problem when using Linq to SQL?

I’d need to search the following field types and they all could be null as well:

  • List item
  • varchar (column LIKE ‘%’ + myText + ‘%’)
  • text (column LIKE ‘%’ + myText + ‘%’)
  • DateTime (column >= myDate – if the ‘myDate’ is not null of course)
  • integer (column = myInt – if ‘myInt’ is not null of course)
  • boolean

I also can’t just use ExecuteQuery because then I don’t get a true ‘entity’ and all of it’s relations/associations.

I just don’t see how I can do this with Linq to SQL. I’m currently without Stored Procs so I’d rather not have one stored proc just for this if I can figure this out with Linq.

  • 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-11T12:06:49+00:00Added an answer on May 11, 2026 at 12:06 pm

    To make LIKE Statements, you can use the Contains method:

    string myText = 'test'; var query = dc.Table.Where(r=>r.Column.Contains(myText)); 

    This will generate this kind of SQL Statement:

    SELECT [t0].[Column], ... [t0].[ColumnN] FROM [Table] AS [t0] WHERE [t0].[Column] LIKE @p0 

    And the @p0 parameter will have '%test%' as value.

    For the Date and int comparison if I understand correctly what do you want, you could do this:

    DateTime? myDate = new DateTime(2009, 3, 15); var query = dc.Table.Where(r=> r.DateColumn > myDate || myDate == null ); 

    So, if myDate is null, the condition DateColumn > myDate wont be evaluated.

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

Sidebar

Related Questions

I'm using dynamic LINQ to create a query from given columns the user selects
I'm trying to use curl with PHP on my box without any success. My
I'd like to use the libFLAC dynamic libraries in an app I'm trying to
Is it possible to define a function and use without ()? Like require(a.php) and
I would like to use the following class across multiple modules without needing log
I'd like to use pure scala code (without side effects) as a immutable message
I'd like to use Sendgrid WebAPI preferably without SMTP or Swiftmailer using the code
Is it okay to use array without single or double quotion like $array[key]? I
My question is like this: Reordering UITableView without reorder control , I use these
Is there any way to use the new dynamic features in the 4.0 framework

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.