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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 76k
  • Answers 76k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Most of the other answers address your code example, so… May 11, 2026 at 2:56 pm
  • added an answer Do you mean something like the following code? if(date_value >… May 11, 2026 at 2:56 pm
  • added an answer I have searched around for information in the past about… May 11, 2026 at 2:56 pm

Related Questions

I'm restructuring opur code to use generics. We do use (out of necessity, no
I have a simple, real life problem I want to solve using an OO
I find this excellent code, posted by aemkei as answers to this questions: How
I have a script to extract certain data from a much bigger table, with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.