Haz 12 2009

LINQ: Max

Category: ASP.NET | LINQLatif @ 16:47

LINQ da SQL deki max islemini nasil mi yapariz?

Asagidaki sekilde,

MDDBDataContext dc = new MDDBDataContext();

var lastNumber = (from r in dc.RevenueSharings
                                  select (int?)r.StatementNumber).Max();

 

SQL server profiler tarafinda asagidaki sekilde goreceksiniz...

SELECT MAX([t0].[StatementNumber]) AS [value]
FROM [dbo].[RevenueSharing] AS [t0]

Tags: , , ,

Comments

1.
Recep GÜZEL Recep GÜZEL Turkey says:

ben de tam son kaydı nasıl alırım diye bakınıyordum. Çok güzel olmuş eline sağlık. Smile

2.
Tagesgeld Rechner Tagesgeld Rechner Germany says:

I guess there is always an easier way ...

3.
privat Krankenversicherung privat Krankenversicherung Austria says:

You look incredibly knowledgeable in your sphere.