Why My Postgresql query could not find the data in Net Core 6?
winanjaya
146
Reputation points
I have a query of Postgresql-14 as below, the record was found if I run it on DBeaver 23.1.4.
I use:
- Dapper 2.0.143
- Npgsql 7.0.4
- Npgsql.EntityFrameworkCore.PostgreSQL 7.0.4
What I don't understand is why it works properly on DBeaver 23.1.4?
I copy the query into a string variable named "sql", but I did not find the record if I run it on my Net Core 6 (C#) code, what I missed?
My C# code is below:
using (var dr = conn.ExecuteReader(sql, new { }))
{
if (dr.Read())
{
double totalUsage = dr.GetDouble(dr.GetOrdinal("totalUsage"));
}
}
I also have tried below, but result returns null
var result = conn.Query(sql, new { }).SingleOrDefault();
Developer technologies .NET Entity Framework Core
780 questions
Developer technologies .NET Other
4,103 questions
Developer technologies C#
11,567 questions
Sign in to answer