I have to rewrite a SQL query to make it work with PostgreSQL. Initially the end of the query was like
returning rowid into ?
And with this command took my C# variable as a parameter. But PostgreSQL doesn’t have into
in its returning construction. How can I make PostgreSQL work the same way?
I tried to use returning
but I can’t connect it with variable.
2
Answers
You SQL query needs to looks something like this
So you just specify the name of the column that you are returning from the query.
Then you code can look like this
In this case I usually create and use an
InsertQuery
function in aQuery
class like below:I assume you have a connection name like
conn
. Here’s how to use theInsertQuery
function