I was able to use your example to make my query compile without errors. However, when I try to reference/set a field from one of selected query columns, I get the error message. See below for more details:
Error message:
Error Detail
============
Description: There is at least one compilation error.
Details:
Error CS1061: 'System.Linq.IQueryable<AnonymousType#1>' does not contain a definition for 'OrderNum' and no extension method 'OrderNum' accepting a first argument of type 'System.Linq.IQueryable<AnonymousType#1>' could be found (are you missing a using directive or an assembly reference?) [GetTaskList.Post.Set_Quote_Number.cs(391,53)]
Program: Epicor.Customization.dll
Method: PrepareException
Line Number: 99
Column Number: 13
`
New left outer join:
var OrderHedDtlVar = (from o in Db.OrderHed.With(LockHint.NoLock)
join od in Db.OrderDtl.With(LockHint.NoLock) on o.OrderNum equals od.OrderNum into jointData_od
join cu in Db.Customer.With(LockHint.NoLock) on o.CustNum equals cu.CustNum into jointData_cu
from jointRecord_od in jointData_od.DefaultIfEmpty()
from jointRecord_cu in jointData_cu.DefaultIfEmpty()
where o.Company == TaskListVar.Company && o.HDCaseNum == CaseNumber && jointRecord_od.OrderLine==1
//orderby l.TaskSeqNum ascending
//orderby l.TaskSeqNum descending
select new
{
o.OrderNum, o.RequestDate, jointRecord_od.PickListComment, jointRecord_cu.CreditHold
});
if (OrderHedDtlVar != null)
{
TaskListVar["rsiOrderNum_c"] = OrderHedDtlVar.OrderNum; <-- error occurs at this line.
}
`
old code without the left outer join:
var OrderHedDtlVar = (from o in Db.OrderHed.With(LockHint.NoLock)
join od in Db.OrderDtl.With(LockHint.NoLock) on o.OrderNum equals od.OrderNum
join cu in Db.Customer.With(LockHint.NoLock) on o.CustNum equals cu.CustNum
where o.Company == TaskListVar.Company && o.HDCaseNum == CaseNumber && od.OrderLine==1
//orderby l.TaskSeqNum ascending
//orderby l.TaskSeqNum descending
select new
{
o.OrderNum, o.RequestDate, od.PickListComment, cu.CreditHold
}).FirstOrDefault();
`