Please do not join to ttTables as written the join above brings back the entire part Tran table and then does the join in memory
Change your code to
foreach(var lot in ttPartLot)
{
var pt = (from tran in Db.PartTran
where tran.JobNum = lot.LotNum
select new {tran.LotNum}).FirstOrDefault();
etc...
}
2 Likes