how can run sql queries in c# win-form and net5, i wana run sql query something like this :
SELECT CAST(FinanceDate AS DATE) AS DATE, SUM(FinancePayment) AS Payment, FinanceType FROM Finances GROUP BY CAST(FinanceDate AS DATE), FinanceType
but i have a problem, in this case and net5 i have two method FromSqlInterpolated()
,FromSqlRow()
when i use this methods, i have an Exception
: The required column 'ID' was not present in the results of a 'FromSql' operation
.
code:
var finance = await dbContext.Finances.FromSqlInterpolated($"SELECT CAST(FinanceDate AS DATE) AS DATE, SUM(FinancePayment) AS Payment, FinanceType FROM Finances GROUP BY CAST(FinanceDate AS DATE), FinanceType").ToListAsync();
what can i do?