My code - I need to capture the element (most recent) entry in my database below and see if it It was over 1 hour ago, the time of the observation time is the date time. I am getting an error saying that "there are more than one element in the sequence for each other" I think the way I was descending I have to do with him, but I do not understand Thanksgiving
[OperationContract] Public Bull LeishOnHor () {Dataclass DDDDatact DB = New Dataclass DBDTtext (); Var mWeathers = (Order by WeatherTab from Weathertable in db.WeatherTables. Obsessions Time Downing Vantable Obsession Time). Single (); DateTime Last Time = Convert. Talktime (MWMD) Adapter (1); If (last time & lt; = DateTime.Now) true back; Second false return; }
asks The result should be an element, and if there is more than one, then put an exception. If you want the possibility, then first () , or first and default () if there is a chance, no results will be found (in which case is empty) If you can get a guarantee that there will always be an element, then try it:
DateTime Deadline = DB Videobles.orderbiddings (w = & gt; W. Obsession Time). Select (w = & gt; W. Obsession Time). first (); Return Last Date Add House (1) & lt; = DateTime.Now; Otherwise something like
Date Time? LastDate = db.WeatherTables.OrderByDescending (w = & gt; W.ObservationTime). Select (w = & gt; W. Observation Time) .FirstOrDefault (); Return to the last date. last date. Add House (1) & lt; = Date time.Now: wrong; Of course, the observation date is declared a timetable?
Comments
Post a Comment