How do I use LIKE with a named parameter in the NHibernate query language?
I need to make a query like the following:
from Product WHERE field1 LIKE 'bla%'
but the "bla" is a parameter that I would like to add as a named parameter.
So it tried:
from Product WHERE field1 LIKE :field1 + '%'
But that doesn't give me any results.
Anyone knows how to do this?
Status:
Open Dec 08, 2006 - 01:12 AM
NHibernate
4answers
Answers
Jan 05, 2007 - 07:02 AM
"select * from Product WHERE field1 LIKE @p1; @p1='blah%' "
Jan 06, 2007 - 05:25 AM
great, exactly what I was looking for.
I'll try it out and you'll get the points afterwards.
Jan 27, 2007 - 03:31 AM
hmmm, i have tried it now, but it doesn't work.
are you sure that your example is for the NHibernate query language? I'm not looking for an SQL way of doing it...
Jun 03, 2007 - 10:46 PM
didn't find the solution for this, but gotta close the question...
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment