var searchAppointment = from app in entities.Appointments
join user in entities.Users on app.UserID equals user.UserID
where app.AppointmentDate >= dtStartdate
&& app.AppointmentDate <= dtEnddate
&& user.UserName == userid
//orderby app
select app;
i want to append query that sort based on First name ,LAst Name;
var searchAppointment = from app in entities.Appointments
join user in entities.Users on app.UserID equals user.UserID
where app.AppointmentDate >= dtStartdate
&& app.AppointmentDate <= dtEnddate
&& user.UserName == userid
orderby app.PatientFirstName, app.PatientLastName
select app;
var searchAppointment = from app in entities.Appointments
join user in entities.Users on app.UserID equals user.UserID
where app.AppointmentDate >= dtStartdate
&& app.AppointmentDate <= dtEnddate
&& user.UserName == userid
orderby app.PatientFirstName, app.PatientLastName
select app;
var searchAppointment = from app in entities.Appointments
join user in entities.Users on app.UserID equals user.UserID
where app.AppointmentDate >= dtStartdate
&& app.AppointmentDate <= dtEnddate
&& user.UserName == userid
orderby app.PatientFirstName, app.PatientLastName
select app;
Hello
info2ambrish
:)
Thanks for your quick reply and as far as I see,I think the answer I've referred above is right——it will sort first by FirstName,if the FirstName is the same,it will sort by LastName。
So what actually it results in and what do you expect?
info2ambrish
Member
385 Points
275 Posts
How to append linq query for order by?
May 04, 2012 12:18 PM|LINK
Hi,
I am using following query:
var searchAppointment = from app in entities.Appointments join user in entities.Users on app.UserID equals user.UserID where app.AppointmentDate >= dtStartdate && app.AppointmentDate <= dtEnddate && user.UserName == userid //orderby app select app;i want to append query that sort based on First name ,LAst Name;
Pls give me solution.
Thanks in advance
Ramesh T
Contributor
5111 Points
827 Posts
Re: How to append linq query for order by?
May 04, 2012 12:45 PM|LINK
Try this
var searchAppointment = from app in entities.Appointments join user in entities.Users on app.UserID equals user.UserID where app.AppointmentDate >= dtStartdate && app.AppointmentDate <= dtEnddate && user.UserName == userid orderby app.PatientFirstName, app.PatientLastName select app;info2ambrish
Member
385 Points
275 Posts
Re: How to append linq query for order by?
May 04, 2012 12:49 PM|LINK
some time sort based on
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to append linq query for order by?
May 06, 2012 01:43 AM|LINK
Hello
info2ambrish
:)
Thanks for your quick reply and as far as I see,I think the answer I've referred above is right——it will sort first by FirstName,if the FirstName is the same,it will sort by LastName。
So what actually it results in and what do you expect?
Reguards!