I have this:
string a = "a+a";
SqlCommand q = new SqlCommand("SELECT * FROM table WHERE a = @a", conn);
q.Parameters.AddWithValue("@a", a);
But the parameterization totally erases the + from a
, leaving me with a a
instead of the desired a+a
. I need that + in place; I just want it escaped, not removed.
Is there a way I can tell C# to escape the + instead of erasing it? I am using .NET Framework 2.0 and don't have the option to upgrade.