Skip to content
Advertisement

Tag: npgsql

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? Answer It looks like you are using Dapper. If so, you want QueryFirst not Execute, as Execute just returns the number of rows

Passing integer value from textbox in SQL select statement

I have an integer in a textbox(Integer retrieved from another form using TOstring) I want to use in an sql select statement. For example, select * from table where column = textbox. The problem is, npgsql gives an error saying I’m trying to pass string into integer column. I try to cast(::int) but still got errors. Any ideas! Answer I

Advertisement