Ejemplo n.º 1
0
        /// <summary>
        /// 应用于单表
        /// </summary>
        /// <typeparam name="dynamic"></typeparam>
        /// <param name="gridpage"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public List <dynamic> PageingGrid <dynamic>(GridPage gridpage, string sql)
        {
            string sql1 = "";

            if (gridpage.ispaging)
            {
                sql1 = @"select * from (select temp.*,rownum rowindex from ( " + sql + " ) temp )" + " where rowindex>" + gridpage.BeginIndex + " and rowindex<" + gridpage.EndIndex;
            }
            else
            {
                sql1 = sql;
            }
            return(Database.SqlQuery <dynamic>(sql1).ToList());
        }
Ejemplo n.º 2
0
        public List <dynamic> PageingGrid <dynamic>(GridPage gridpage, string tablename, string whereStr)
        {
            string sql1 = "";

            if (gridpage.ispaging)
            {
                sql1 = string.Format(@"SELECT * FROM 
(SELECT T.*, ROWNUM AS rno FROM {0} T WHERE ROWNUM<{1} {3} 
) WHERE rno>{2}", tablename, gridpage.EndIndex, gridpage.BeginIndex, whereStr);
            }
            else
            {
                sql1 = string.Format("SELECT * FROM {0} T WHERE 1=1 {1}", tablename, whereStr);
            }
            return(Database.SqlQuery <dynamic>(sql1).ToList());
        }