Nhibernate: using Expression -


Using NHibernate, I want to query on an integer datatype, but it always returns the exact match.

How can I write an expression that gives a list starting with the number entered?

I'm currently using it: (clientNum is a long)

  Add crit (Like expression ("client number", client new)); // It always gives me only the exact match  

So I have tried the following, but its a complication of wroing type (its only expected one string)

  Crit.Add (like expression ("ClientNumber", Client New, MatchMode.Start));  

Update: Also I tried the client number. Toastring () But I'm getting a DB exception which is saying invalid type.

I want to use SQL, but how can I do this in nHibernate ??

SELECT * CLIENTWHERE WHERE CLIENT'S NAME Names '3%' - I wanted a list starting with SAC 3 ...

) in HQL I think that you will need to put the value in the string and then apply your ' like ' section it should be able to do all in HQL From that, the same thing that you can do it using SQL expressions (eg. expression. SQL (...) ) and using T-SQL.


Comments