0

I can find >= <= etc. but not equal for a date only using System.Linq.Dynamic DynamicQueryable Where.

Does anyone have an example? Searched the whirled wild web and found nothing yet.

Example:

SELECT * FROM ORDERS WHERE CONVERT(date, Created) = '2016-07-08'

Trober
  • 259
  • 1
  • 2
  • 8

1 Answers1

1

Appears a slight modification of this will answer this question: Dynamic LINQ DateTime Comparison String Building - Linq To Entities.

If you want orders for a specific date (no time involved):

dbContext.Orders.Where("( Created >= DateTime(2016, 07, 08) AND Created < DateTime(2016, 07, 09) )")

And per article above, if you have other columns in the WHERE clause, you'll have to build that yourself.

Community
  • 1
  • 1
Trober
  • 259
  • 1
  • 2
  • 8