Пример #1
0
        /// <summary>
        /// 查询分页总数
        /// </summary>
        /// <returns></returns>
        public int Count(string sup, string sub)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select count(id) from article where status=1 ");
            if (!String.IsNullOrEmpty(sup))
            {
                sb.Append(" and supnum=@sup ");
            }
            if (!String.IsNullOrEmpty(sub))
            {
                sb.Append(" and subnum=@sub ");
            }
            var param = new { sup = sup, sub = sub };

            return(dal.QueryScalar <int>(sb.ToString(), param));
        }