Where am I going wrong with the count in Hql

Posted by Bipul on Stack Overflow See other posts from Stack Overflow or by Bipul
Published on 2010-05-27T16:49:47Z Indexed on 2010/05/27 16:51 UTC
Read the original article Hit count: 166

Filed under:
|
|

So I only want the count of the results not the results themselves therefore I am using count in hql. So, below is the query

(int)  Session.CreateQuery("select count(*) from TableName where Lhs=Rhs").UniqueResult();

But it is giving me the error Specified cast is not valid..

So, can any body tell me how to cast the count to int.

Any help is very much appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc