Search Postgresql Archives

Call Stored Procedure with inout parameters in c#

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();
        }

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux