Order by does not work with Concat() in LINQ

Viewed 2515

Using VB.net and the following LINQ statement. I suspect the "Order by" does not work with Concat(). I want to list the current item the user has and then list more available items in asending order. So first i select the current item from the db and then select the next available items in order. LINQ is ignoring the order by statement and sorting by the PK (which is itemID) I examined the list immediately after executing the statement. When I break up the statement and do them separately they work as predicted. Any ideas, suggestions or comments. Thanks, PM

(From items In myDatabase.ItemAssignments _
 Where items.BuildingID = buildingID _
 And items.ResidentID = ResidentID _
 Select items).Concat(From moreitems In myDatabase.ItemAssignments _
                      Where moreitems.occupied = 0 _
                      And moreitems.BuildingID = buildingID _
                      Order by moreitems.Floor, moreitems.ItemNumber _
                      Select moreitems)
1 Answers
Related