Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
var query = from propertyMaster in rdc.tbl_PropertyMasters

                    join propertLocaton in rdc.tbl_Locations
                    on propertyMaster.LocationId equals propertLocaton.LocationId

                    join propertyUser in rdc.tbl_Users
                    on propertyMaster.UserId equals propertyUser.UserId

                    //orderby propertyMaster.DetailViewCount descending

                    select new
                    {
                        propertLocaton.LocationName,
                        //propertLocaton.LocationId,
                        propertyMaster.DetailViewCount,
                        propertyMaster.Price,
                        propertyUser.FirstName,
                        propertyUser.LastName
                    };
Posted
Comments
Vineet_2109 9-Mar-11 8:25am    
If i remove order then it will sort directly. But i want to be selected manually by User so how can i do this ??
Coding C# 9-Mar-11 9:00am    
You will have to write two different queries for this.
One for ascending and one for descending and execute as per the user parameter.


Cant do asc/desc both in single linq.
Vineet_2109 9-Mar-11 9:23am    
oh thanks...

1 solution

Could you not have an asc query and return the reverse if desc is required. That way you have only one query.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900