Saturday, August 6, 2011

Max Id of table find out by linq

Var idd = dt.bankdetails.Max(s => s.id);
        if (idd == null)
        {
            idd = 0;
        }
        bt.id = idd + 1;


Here dt is dataclass and bankdetails is table name.

No comments:

Post a Comment