I am writing some code using Linq and am getting errors for my linq statement:
“InvcHead” is a type which is not valid in the given context
“OrderHed” is a type which is not valid in the given context
I downloaded LINQPad and the Epicor_10_LINQPad_Starter.linq and am getting the same error in Linqpad. what could i be doing wrong?
here is my ‘query’
var orderNum = (from g in GLJrnDtl
join i in InvcHead
on new { comp = g.Company, invc = g.LegalNumber} equals new {comp = i.Company, invc = i.InvoiceNum }
join o in OrderHed
on new { comp = i.Company, order = i.OrderNum} equals new {comp = o.Company, order = o.OrderNum }
select new { HistoryRow = g.SysRowID, OrderNum = i.InvoiceNum });
Well, I added the database context and that throws an error…
var orderNum = (from g in ERP.GLJrnDtl
join i in ERP.InvcHead
on new { comp = g.Company, invc = g.LegalNumber} equals new {comp = i.Company, invc = i.InvoiceNum }
join o in ERP.OrderHed
on new { comp = i.Company, order = i.OrderNum} equals new {comp = o.Company, order = o.OrderNum }
select new { HistoryRow = g.SysRowID, OrderNum = i.InvoiceNum });
3 errors, all the same:
The name ‘ERP’ does not exist in the current context
Under References there is System.XML.Linq. There is nothing under Usings. Am I missing something?
Yes, I knew that - I was able to get it to work (link) in a BAQ, and forgot that bit while fighting with the other errors. That is the actual link i have to use! What the heck!!! I was hoping to use a cast or some such, but it doesn’t look like it.