1

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%'

1 Answer 1

3

Try this:

dbcontext.Schedules.Where(s => s.SerialNo == '11119' && s.DueDate.Year == 2012)
Sign up to request clarification or add additional context in comments.

7 Comments

What type is DueDate? You should edit your post and show us how looks like your Schedule entity.
it's sir Datetime in SQL database & here is function................... public List<Schedule> GetListBySearch(string search) { return db.Schedule.Where(s => s.SerialNo == '11119' && s.DueDate == '2012').ToList(); }
Add the Schedule class to your question, we will have a better idea
Actually sir, Schedule is the table name as db.schedule & I want to get a list of history for serialno=11119 where Duedate=2012
Ok, DueDate is nullable!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.