Example #1
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="sqls">SQL语句</param>
        /// <param name="pageIndexs">当前页</param>
        /// <param name="PageSize">每页显示数量</param>
        /// <param name="pageCount">总条数</param>
        /// <returns></returns>
        public List <JMP.MDL.jmp_app_report> SelectList(string sqls, int pageIndexs, int PageSize, out int pageCount)
        {
            string sql = string.Format(sqls);

            SqlParameter[] s = new[] {
                new SqlParameter("@sqlstr", sql.ToString()),
                new SqlParameter("@pageIndex", pageIndexs),
                new SqlParameter("@pageSize", PageSize)
            };
            SqlDataReader reader = DbHelperSQLTotal.RunProcedure("page", s);

            pageCount = 0;
            if (reader.NextResult())
            {
                while (reader.Read())
                {
                    pageCount = Convert.ToInt32(reader[0].ToString());
                }
                if (reader.NextResult())
                {
                    if (reader.HasRows)
                    {
                        dt.Load(reader);
                    }
                }
            }
            reader.Close();
            return(DbHelperSQLTotal.ToList <JMP.MDL.jmp_app_report>(dt));
        }