Cleaning Of VarChar PgSqlParameter To Function

Cleaning Of VarChar PgSqlParameter To Function

Postby HumanShield » Mon 24 Apr 2006 14:50

int SearchId = 0;
string Criteria = "you're";

PgSqlCommand cmd = new PgSqlCommand("SELECT public.createsearchresult(@querystring_in);", DBUtils.GetConnection());
cmd.Parameters.Add(new PgSqlParameter("@querystring_in", PgSqlType.VarChar, 100));
cmd.Parameters["@querystring_in"].Value = "%" + Criteria + "%";

cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();

results in:

CoreLab.PostgreSql.PgSqlException: syntax error at or near "re"

---

Is this expected behavior? I would have expected this to properly escape single quotes as with other VarChar parameters.
HumanShield
 
Posts: 7
Joined: Mon 24 Apr 2006 14:30

Postby Alexey » Tue 25 Apr 2006 07:27

Which version of PostgreSQLDirect .NET do you use?
Your code works fine on the latest one. If you do use the latest version, please provide us with the code of your public.createsearchresult() function as well.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby HumanShield » Wed 26 Apr 2006 16:50

I'm running the 2.50 professional - pre-release copy. I haven't had the chance to swap over to stable yet :( I'll give that a shot.
HumanShield
 
Posts: 7
Joined: Mon 24 Apr 2006 14:30


Return to dotConnect for PostgreSQL