Abdul Khaliq
Abdul Khaliq

Reputation: 2285

How to write SQL date format Like query into LINQ Or Entity Framework

I am using Entity frame work, i want to convert SQL query of LIKE date to Entity framework. here is the query

 Select * from Schedule where SerialNo='11119' and DueDate like '%2012%'

Upvotes: 1

Views: 556

Answers (1)

JuChom
JuChom

Reputation: 5989

Try this:

dbcontext.Schedules.Where(s => s.SerialNo == '11119' && s.DueDate.Year == 2012)

Upvotes: 3

Related Questions