Re: Create stored procedure from C#.net

From: Brar Piening <brar(at)gmx(dot)de>
To: postgresuser <ehsan(dot)hafeez(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Create stored procedure from C#.net
Date: 2012-07-16 20:29:54
Message-ID: 500479C2.2010301@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

postgresuser wrote:
> I am using PostgreSql 8.3 version. I want to create stored procedure from
> C#.net. Is it possible? Any idea.

You probably don't mean something like:

using Npgsql;
...
using (NpgsqlConnection connection = new
NpgsqlConnection("Server=127.0.0.1;Database=postgres;Integrated
Security=true;"))
{
string createFunctionCommand = @"
CREATE OR REPLACE FUNCTION my_cool_function() RETURNS integer AS
$BODY$
select 42;
$BODY$
LANGUAGE sql IMMUTABLE;
";
NpgsqlCommand command = new NpgsqlCommand(createFunctionCommand,
connection);
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}

Something like PL/C# to write functions in C# doesn't exist.

Regards,

Brar

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Bartlett 2012-07-16 21:30:13 Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)
Previous Message Philip Couling 2012-07-16 19:49:57 Re: How do write schema independent install files for functions.