Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to sort Linq Result Set

Status
Not open for further replies.

tlhawkins

Programmer
Dec 28, 2000
797
US
Hey,

I have a query that is Concatenating 2 select statements into 1 result set. I now need to sort them together.

This is the query:
Code:
Dim fRem = ((From r In db.Reminders _
Where r.CreatedBy = ui.UserID _
Select ID = r.ID.ToString, Name = r.Name, Time = r.ReminderQueues.FirstOrDefault.Time, _
TimeZone = r.TimeZone, CarrierID = r.ReminderQueues.FirstOrDefault.Carrier.ToString, _
CalID = r.ReminderQueues.FirstOrDefault.CalendarID.ToString _
Order By Time _
).Take(5)).Concat( _
(From c In db.Appointments _
Where c.UserID = ui.UserID And _
Not (From r2 In db.ReminderQueues _
  Select r2.CalendarID).Contains(c.ID) _
Select ID = "0", Name = c.Subject, Time = c.StartTime, _
TimeZone = "EST", CarrierID = "", CalID = c.ID.ToString _
Order By Time)).Take(5)

That query is returning the correct results, but now I need them sorted together. The concat just puts one select results after the other. The Time field is a DateTime and that's what I need to sort on.

I've read several pages on the subject and I'm stumped. can someone give me an easy explanation of how to do this?

Thanks

Travis Hawkins
jobs.bestcodingpractices.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top