I am doing a linq-to-sql query and I want the LastOrDefault operator to be available but it is not. Therefore, I am writing a question like this:
TheUserNote = ((Note in myDC. User notes where note. UserID == Choose theUserID note. Note text). MyDC.UserNotes where N.UserID == Select theUserID n.NETID) .count () - 1)). SingleOrDefault (), Actually, I want to skip to use and use the calculation for the last item: Calculate how many items are, 1 Depot, and that number Leave for It's not working and I'm looking to fix it. The problem is that sometimes counting can be 0, so I think the parameters are not valid, due to this there will be a count-1.
Any suggestions?
Thank you.
You can try . again (). FirstOrDefault () , or if you have a date column or the primary key column try. Order boydesking (...). FirstOrDefault () . Use your variable names and comments:
Var TheUserNote = MyDC .UserNotes. Where (x = & gt; x.UserId == TheUserID). OrderbidScaching (x = & gt; x.NoteDateTime) .FirstOrDefault ();
Comments
Post a Comment