Skip to content
Advertisement

How to Count from sql as a value in Npsql

I am using Npgsql to access postgresql database

and I am running a query:

The query will return value 4, but my a gets -1.what is the problem here and how can I solve it?

Advertisement

Answer

It looks like you are using Dapper. If so, you want QueryFirst not Execute, as Execute just returns the number of rows

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement