Home
Manage Your Code
Snippet: test (C#)
Title: test Language: C#
Description: test Views: 60
Author: fu lin Date Added: 7/28/2008
Copy Code  
1public long GetRegisteredUserCount(int countryId)
2        {
3            string sql = "select count(*) Ret from [user] u inner join UserWidget on u.id = userwidget.userid where u.CountryId = :country";
4            ISQLQuery query = NHibernateSession.CreateSQLQuery(sql);
5            query.SetInt32("country", countryId);
6            query.AddScalar("Ret", NHibernateUtil.Int64);
7
8            object result = query.UniqueResult();
9            return result == null ? 0 : Convert.ToInt64(result);
10        }