I have a table called messages. I have a messagedate field. I want to count how many times messagedate occurs between 2 dates.
I am having trouble formulating the query in linq.
string currYear = DateTime.Now.Year.ToString();
var TotalSmsJan = (from x in db.Messages
where (x.MessageDate >= '1/1/@currYear') && (x.MessageDate >= '1 /31/@currYear')
select x).Count();
Ideally I would like the message count for each month, but would be happy to get them one at a time as in code above.