How do I get a LIKE operator to work in a SQl query? My qury looks like this:
string sql = @"SELECT {cust.*} FROM tblCustomer {cust} WHERE cust.strFirstName LIKE %:strFirstName%";
m_session.CreateSQLQuery(sql, "cust", typeof(Customer)).SetString("strFirstName", firstName).List();
and throws an exception:
Not all named parameters have been set: Iesi.Collections.ListSet []
if I modify the statement to:
string sql = @"SELECT {cust.*} FROM tblCustomer {cust} WHERE cust.strFirstName = :strFirstName";
it works fine. What should i do? Im running MS SQl2000 and the column is nvarchar(100)
Thanks
/Kalle
|