Insert into postgre database from a stored procedure

From: techsupport(at)datatronicsnig(dot)com
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Insert into postgre database from a stored procedure
Date: 2018-12-03 02:34:41
Message-ID: 201812030234.wB32Yf7e031794@mail549c25.carrierzone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


 

Hi

I have C#  application that uses Dapper as its ORM

I am trying insert  records into a postgresql database through a stored procedure

I get a syntax error on  cmd.ExecuteNonQuery();  line

Can you please mail me some documents to help me solve the problem or point me 

in the direction of the documents i should be reading.

my script is shown below

Thanks

Olukay

 

  NpgsqlConnection conn = new NpgsqlConnection("Host = 127.0.0.1; Database = Tournaments; Port = 5432; Username = postgres; Password = manager");
            conn.Open();
                                 
            {
                NpgsqlCommand cmd = new NpgsqlCommand("public.spabsecode_insert", conn);
                var p = new DynamicParameters();

                cmd.Parameters.Add(new NpgsqlParameter("absecodex", model.Absecode));
                cmd.Parameters.Add(new NpgsqlParameter("absedescx", model.Absedesc));

                cmd.ExecuteNonQuery();

                model.Id = p.Get<int>("Id");

            }
        }

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Lutz Horn 2018-12-03 06:27:18 Re: Insert into postgre database from a stored procedure
Previous Message jbullock 2018-11-29 21:18:15 I'm late, but yeah, default to postgreSQL -- Re: Choice of DB