I need to b开发者_StackOverflow中文版e able to display data for all date range and for the same date range but only for Saturdays.
Data stored in sql server.
Table:
DateTime Vlaue
Is it possible to create linq to sql
query which would do that?
Or just select all for particular range and than on server side find all Saturdays?
What is the better way to do that?
You should be able to do something like this:
var results = Entities.YourTable.Where(r => r.SomeDate.DayOfWeek == DayOfWeek.Saturday);
I'd be inclined to just query the database once, then use linq to objects on the result set for the saturday data...
var values = db.Values.ToList(); // assuming your table is called values
var satValues = values.Where( v => v.TheDate.DayOfWeek == DayOfWeek.Saturday);
精彩评论