Ho questa domanda che ho cercato di capire come convertire a LINQ:Ti prego, aiutami a convertire SQL per LINQ
select bjbecd, bjbesk, areotx
from insku
inner join iniwre on bjcomp=a7comp and bjbecd=a7becd and bjbesk=a7besk
inner join initem on bjcomp=arcomp and bjbecd=arbecd
where a7comp=1 and
a7wcde in (1,10) and
a7ohdq>0 and rtrim(a7becd) + rtrim(a7besk) not in
(select skucode from eoditems)
Ed ecco il mio LINQ finora:
(from i in db.INSKUs
join w in db.INIWREs on
new { i.BJCOMP, i.BJBECD, i.BJBESK }
equals
new { w.A7COMP, w.A7BECD, w.A7BESK }
join t in db.INITEMs on
new { i.BJCOMP, i.BJBECD }
equals
new { t.ARCOMP, t.ARBECD }
where w.A7COMP == 1
where w.A7WCDE == 1 || w.A7WCDE == 10
where w.A7OHDQ > 0
where !(from z in db.EODItems
select z.SkuCode).Contains(w.A7BECD.TrimEnd() + w.A7BESK.TrimEnd())
select new { i.BJBECD, i.BJBESK, t.AREOTX }
);
Ricevo un messaggio di errore sul primo join che dichiara "Il tipo di una delle espressioni nella clausola join non è corretto. Non è stato possibile digitare l'inferenza nella chiamata a" Partecipa "."
Tutte le ricerche che ho eseguito, relative agli errori di corrispondenza dei tipi, ma quadrupla ho controllato tutti i miei tipi all'interno dei join e sono gli stessi.
Hai già configurato le tue chiavi esterne? Se è così, questo può essere banale. –
Hai provato a ritagliare uno dei join (e tutto ciò che dipende da esso) per vedere se sarebbe compilato/eseguito? Almeno in quel modo potresti restringere a quale si "lamenta"? – R0MANARMY