How to add parameter val containing single quote
I am adding a parameter value to an OracleCommand parameter. If I add a value that does NOT contain a single quote, the query works and I get the expected results returned. If I add a value that contains a single quote, such as "'CJ','CL','CP'", I get ORA-01403 returned (no rows found). I have tried preceding each single quote with another single quote, preceding each single quote with a backslash, and each of these with preceding the entire string with '@'. None of these syntaxes work. It appears that ADO stops reading as soon as it hits the first single quote. I am working in Visual Studio .NET 2003 in C#. The where clause needs to search for multiple values (e.g., WHERE work_schedule IN ('CJ','CL','CP')).
I know that parameterized queries are the correct way to handle these queries, and I have been using them in C for years. I can't believe that there is no way to create a parameterized query in C# .net where the where clause must search for multiple values.
Does anyone know how to do this??
Thanks
|