Error Devart.Data.PostgreSql.PgSqlException: 'operator does not exist: integer = text'
Posted: Tue 21 Apr 2020 08:48
I tried to do a request but there is an exception: Devart.Data.PostgreSql.PgSqlException: 'operator does not exist: integer = text'. The table has correct fields with types.
It works with library Npgsql. What reason can be?
Thank you in advance for your support.
It works with library Npgsql. What reason can be?
Thank you in advance for your support.
Code: Select all
static void Main(string[] args)
{
PgSqlParameter[] myParameters = new PgSqlParameter[]
{
new PgSqlParameter("@Param0", PgSqlType.Int) {Value = 0} ,
new PgSqlParameter("@Param1", PgSqlType.Int) {Value = 10},
new PgSqlParameter("@Param2", PgSqlType.Int) {Value = 20 }
};
PgSqlConnection pgConnection = new PgSqlConnection("...");
var query = "SELECT * FROM public.V_BASES_W_4ALL AS vw WHERE ((ID = ANY (ARRAY[@Param0,@Param1,@Param2]))) limit 10000";
PgSqlCommand pgCommand = new PgSqlCommand(query, pgConnection);
for (int i = 0; i < myParameters.Length; i++)
{
pgCommand.Parameters.Add(myParameters[i]);
}
try
{
pgConnection.Open();
pgCommand.ExecuteNonQuery();
}
finally
{
pgConnection.Close();
}