Insert parameter Array

Insert parameter Array

Postby chif » Mon 15 Aug 2016 04:34

Hello.
I'm having problems with passing parameters (array of bigint).

Code: Select all
pgConnection.Open();
using (var cmd = pgConnection.CreateCommand())
{
     var par = new PgSqlParameter("id", PgSqlType.Array);
     par.Value = new PgSqlArray(new object[] {0, 1, 2}, PgSqlType.BigInt, 1, 3);
     cmd.Parameters.Add(par);
     cmd.CommandText = "INSERT INTO tbl1 (clmn1) VALUES (unnest($1))";
     cmd.ExecuteNonQuery();
}
pgConnection.Close();


Error:
Error: 42804: could not determine polymorphic type because input has type "unknown"


dotConnect for PostgreSQL 7.6 Express
Devart.Data.PostgreSql 7.6.714.0

Thanks
chif
 
Posts: 2
Joined: Mon 15 Aug 2016 03:30

Re: Insert parameter Array

Postby chif » Tue 16 Aug 2016 06:06

Ok, just fixed:
cmd.CommandText = "INSERT INTO tbl1 (clmn1) VALUES (unnest($1::bigint[]))";
chif
 
Posts: 2
Joined: Mon 15 Aug 2016 03:30


Return to dotConnect for PostgreSQL