From: | İlyas Derse <ilyasderse(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Call Stored Procedure with inout parameters in c# |
Date: | 2019-11-25 14:46:29 |
Message-ID: | CALcdmyTni2MGmyt4tVuUjH4bgLvQLKBuxaCoT8+-Th+Vqx_wXA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I tried with inout parameters but it did not work correctly.
here is my procedure :
CREATE OR REPLACE PROCEDURE public.testing ( INOUT x int )
LANGUAGE 'plpgsql'
AS $$
BEGIN
x := x * 3;
END ;
$$;
my C# code:
public void myMethod2()
{
CRUD.con.Open();
int a = 5;
using (var cmd = new NpgsqlCommand("call public.testing();",
CRUD.con))
{
var objParam = new NpgsqlParameter("x",
NpgsqlDbType.Integer)
{ Direction = ParameterDirection.Output };
objParam.Value = 5;
cmd.Parameters.Add(objParam);
cmd.ExecuteNonQuery();
Console.WriteLine(objParam.Value);
}
CRUD.con.Dispose();
}
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2019-11-25 14:46:40 | Re: Pgadmin 4 schema visibility |
Previous Message | Michael Korbakov | 2019-11-25 12:01:31 | Re: Adding LIMIT changes PostgreSQL plan from good to a bad one |