Resolved: How to escape characters like '':$@?" used in SQL CommandText?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
bpipe
Posts: 19
Joined: Mon 08 Oct 2012 12:14

Resolved: How to escape characters like '':$@?" used in SQL CommandText?

Post by bpipe » Thu 02 Nov 2017 16:49

PostgreSQL SQL commands can sometimes contain characters (:?) which are treated by ADO. NET provider as placeholder for value from DbParameter. For example those symbols can appear in:
* PostgreSQL type cast - foo::text
* DateTime values formatted as - '02.11.2017 19:39'

I'm trying to execute SQL command containing colon (:) symbols, and they are not intended to be treated as parameters placeholder.
PgSqlCommand cmd;
cmd.CommandText= "UPDATE TABLE 'foo' SET baz= bar::TEXT";
cmd.ExecuteNonQuery(); //Exception here cause parameter :text is missing.
Last edited by bpipe on Fri 03 Nov 2017 13:48, edited 1 time in total.

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Re: How to escape characters like '':$@?" used in SQL CommandText?

Post by Pinturiccio » Fri 03 Nov 2017 10:32

We could not reproduce the issue. Please tell us your dotConnect for PostgreSQL version.

Please also create and send us a small test project with corresponding DDL\DML scripts which reproduces the issue with all characters that you want to escape.

And tell us your PostgreSQL server version.

bpipe
Posts: 19
Joined: Mon 08 Oct 2012 12:14

Re: Resolved: How to escape characters like '':$@?" used in SQL CommandText?

Post by bpipe » Fri 03 Nov 2017 13:50

The problem resolved, sorry it was false alert.

Post Reply