Question

I have a database on windows phone application. I have to-do items and I want to list them grouped like "Today", "Tomorrow" etc. I have a keyedlist based on that and I'm using longlistselector with groups to show data.

I have a date column on database and want to group items by using it. Comparing date with it I want to group items on calling from database like "Today", "Tomorrow", "Other" etc. I tried some let functions but it always throws exception. How can I do when calling it with LINQ?

Was it helpful?

Solution

You will have to instruct the LINQ query that the local part should be done locally:

var tariheGoreGrupla = (from hatirlatma in
                           (from hatirlatmaX in toDoItemsInDB 
                            orderby hatirlatmaX.Due_Date
                            select hatirlatmaX).AsEnumerable()
                       let gun = GetDate(hatirlatma as ToDoItem)
                       group hatirlatma by gun into tariheGore);

AsEnumerable() means "from this point on, use the local enumerable methods and don't try to convert this into an SQL query".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top