I'm using WPF, C#, Entity Framework database-first with a SQL Server database.
I did execute this query with successfully in SQL Server:
SELECT
SUM(MEGHk) AS Meghksm,
SUM(MABL_K) AS Mablksm,
SUM(N_MOIN) AS N_MOINSM,
SUM(IMBAA) AS IMBAAsm
FROM
INVO_LST
WHERE
(TAG = 2) AND (NUMBER = 4)
In C# code:
var quer_Sumfactor5 = dbms.Database.SqlQuery<INVO_LST>("SELECT SUM(MEGHk) AS Meghksm, SUM(MABL_K) AS Mablksm, SUM(N_MOIN) AS N_MOINSM, SUM(IMBAA) AS IMBAAsm FROM INVO_LST WHERE(TAG = 2) AND (NUMBER = " + TextB_Number.Text + ")").ToList();
I get this error:
I think Entity Framework needs all columns that won't select single or multi columns.
How can I get the result of my query as in SQL Server?
Please help
I hope my explanation is clear