I need to work around an NHibernate bug I reported here. Essentially, NHibernate will generate multiple SQL parameters for the same HQL parameter, which results in problems for queries that use a parameter in a grouping construct.
Until the bug is fixed, I figured I'd just concatenate the parameter into the HQL. Obviously this is susceptible to SQL injection unless I escape the parameter value (since it's HQL, I can't use regular ADO.NET parameters).
Is there a method within System.Data somewhere that will escape a parameter value, making it safe to concatenate into a SQL string? I'm using SQL Server 2005, and I'm happy to do something specific to that platform for the short term until the NHibernate bug is fixed.
Thanks, Kent