I have this situation. I call CreateQuery
with this query and I get Exception.
string sql = "SELECT VALUE CP
FROM CIC_PRODUZIONE_OPERAZIONI_View AS CP
WHERE CP.CD_PLANT = 5
AND CP.CD_POSTI = 10946
AND (CP.FL_STATE IN {N'D',N'N',N'M'})
AND EXISTS (SELECT 1
FROM CIC_OPERAZIONI AS C
WHERE CP.CD_CIC_PRODUZIONE = C.CD_CIC_PRODUZIONE
AND C.CD_POSTI = 10894
AND C.AFCDOPER = (SELECT VALUE TOP (1) D.AFCDOPER FROM CIC_OPERAZIONI AS D
WHERE D.CD_CIC_PRODUZIONE = CP.CD_CIC_PRODUZIONE
AND D.AFCDOPER > CP.AFCDOPER
ORDER BY D.AFCDOPER))
ORDER BY CP.AFCDPROD, CP.FL_STATE, CP.AFESPSAP, CP.AFESPMOD, CP.AFCDOPER";
ObjectQuery<T> entities = CreateQuery<T>(sql);
This is the Exception:
EntitySqlException: The argument types 'Edm.Decimal' and 'Transient.collection[Edm.Decimal(Nullable=True,DefaultValue=,Precision=4,Scale=0)]' are incompatible for this operation.
The problem seems to be when I try to select the TOP
value.
Any suggestion?
Aucun commentaire:
Enregistrer un commentaire