Denmark Puso

Denmark Puso

  • NA
  • 232
  • 50.6k

Joining table does not accept null values. mvc5 c#

Mar 12 2020 10:48 PM
i have 3 tables and when the 2 table is null i have an error. what is the problem with my code.
 
  1. var list = (from t in tracking  
  2.                         join d in _departureItemsTableService.GetAll() on t.box_id.Trim() equals d.BoxNo.Trim() into mar from submark in mar.DefaultIfEmpty()  
  3.                         join dt in _departureTableService.GetAll() on submark.DepartureId equals dt.DepartureId into dep from depart in dep.DefaultIfEmpty()  
  4.   
  5.                         select new TrackingListModel  
  6.                         {   
  7.                             Id = t.Id,  
  8.                             Name = t.firstname_s + " " + t.lastname_s,   
  9.                             Departure = depart?.DepartureDate ?? String.Empty,  
  10.                         });  
 

Answers (2)