示例#1
0
        /// <summary>
        /// 处理返回结果集合
        /// </summary>
        /// <param name="pagin">分页类</param>
        /// <param name="tableName">表名</param>
        /// <param name="key">排序键值</param>
        /// <param name="comlums">列名</param>
        /// <param name="condition">条件</param>
        /// <returns>结果集</returns>
        public static SqlDataReader DisSqlReader(PaginationModel pagin, string tableName, string key, string comlums, string condition)
        {
            SqlParameter[] ps = new SqlParameter[]
            {
                new SqlParameter("@tableName", tableName),
                new SqlParameter("@key", key),
                new SqlParameter("@comlums", comlums),
                new SqlParameter("@condition", condition),
                new SqlParameter("@start", pagin.GetPageDate()),
                new SqlParameter("@end", pagin.GetEndDate()),
                new SqlParameter("@DataCount", pagin.DataCount)
            };
            ps[6].Direction = ParameterDirection.Output;
            ps[6].Size      = 10;
            SqlDataReader dr = DBHelper.ExecuteReader("GetDataPagePagination", ps, CommandType.StoredProcedure);

            return(dr);
        }
示例#2
0
        /// <summary>
        /// 处理返回结果集合
        /// </summary>
        /// <param name="pagin">分页类</param>
        /// <param name="tableName">表名</param>
        /// <param name="key">排序键值</param>
        /// <param name="comlums">列名</param>
        /// <param name="condition">条件</param>
        /// <returns>结果集</returns>
        public static DataTable GetDataTable(PaginationModel pagin, string tableName, string key, string comlums, string condition)
        {
            SqlParameter[] ps = new SqlParameter[]
            {
                new SqlParameter("@tableName", tableName),
                new SqlParameter("@key", key),
                new SqlParameter("@comlums", comlums),
                new SqlParameter("@condition", condition),
                new SqlParameter("@start", pagin.GetPageDate()),
                new SqlParameter("@end", pagin.GetEndDate()),
                new SqlParameter("@DataCount", pagin.DataCount)
            };
            ps[6].Direction = ParameterDirection.Output;
            ps[6].Size      = 10;
            DataTable dt = DBHelper.ExecuteDataTable("GetDataPagePagination", ps, CommandType.StoredProcedure);

            pagin.DataCount = Convert.ToInt32(ps[6].Value.ToString());
            return(dt);
        }