I am making a small demo project where i wish to retrieve 2nd highest salary on label,using linq to sql
Here is my code :
public void Get2ndHighestSalalry()
{
using (DemoDbEntitiesss db = new DemoDbEntitiesss())
{
var query =db.Employees
.OrderByDescending(e => e.Salary)
.Skip(1)
.First();
lbl2ndhighestSalalry.Text = query.ToString();
}
}
But it returning me below code on my label :
My Output is :
second Highest Salary is : asp.netPracticeAgainWithLINQ.DB.Employee //here i want 2nd highest salary
Where i am making mistake ?
Any help would be much appreciated.
Thanks