Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

how to get the max value from the linq statement, Please help

$
0
0

Hi

how can I make the following linq statement to get maximum value of reading for the year and month and depot, Any help would be very appreciated

public long GetMaxMeterReading(int depotno, int year, int month)   // 
        {
            long maxRead = (from d in ctx.goMeterReading
                            where d.DepotNo == depotno && d.ReadingYear == year && d.ReadingMonth == month
                            select d.Reading).SingleOrDefault();
            return maxRead;
        }

Regards

Pol


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>