Jayanth Reddy

Jayanth Reddy

  • 1.7k
  • 206
  • 2.3k

Retreiving Data

Aug 13 2019 2:32 AM
I am trying to retreive the Max value of Id from the sql server using "Linq to sql" to display in the form, but getting 0 as the value.Instead of Max, if i use a Count() it is giving the exact count value.Can anyone help me how to get the max value of a column using linq to sql query.
CompanyDataContext dc = new CompanyDataContext();
Employee obj = new Employee();
var c = ((from Employee in dc.Employees select obj.id).Max());

Brought to you by:

Answers (2)