How To Run A Postgres Stored Proc Or Function In C#

IT Support Forum Forums Development C# Development C# Coding How To Run A Postgres Stored Proc Or Function In C#

Viewing 0 reply threads
  • Author
    Posts
    • #2383
      Webmaster
      Keymaster

      Here’s how to run a Postgres Function or Postgres Stored Procedure using C#

      NpgsqlCommand SqlCommand = new NpgsqlCommand(“stored_proc_name”)
      { CommandType = CommandType.StoredProcedure };

      SqlCommand.Parameters.AddWithValue(“param_name1”, NpgsqlTypes.NpgsqlDbType.Text, “param 1”);
      SqlCommand.Parameters.AddWithValue(“param_name2”, NpgsqlTypes.NpgsqlDbType.Text, “param 2”);

      You can then execute the NpgsqlCommand in the normal way.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.