Resolved: How to escape characters like '':$@?" used in SQL CommandText?
Posted: 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.
* 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.