示例#1
0
        /// <summary>
        /// 生成分页语句
        /// </summary>
        /// <param name="providerName"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public string CreatePagerSql(string providerName, WebPager pager)
        {
            string sql = "";

            if (SqlCreateType == ControlSqlCreateType.RowNum)
            {
                if (providerName.IsEqualTo(DBProvider.SqlClient))
                {
                    sql = CreateSqlByRowNum(pager.PageIndex, pager.PageSize);
                }
                else if (providerName.IsEqualTo(DBProvider.OracleClient))
                {
                    sql = CreatePLSqlByRowNum(pager.PageIndex, pager.PageSize);
                }
            }
            else if (sqlCreateType == ControlSqlCreateType.TopN)
            {
                if (providerName.IsEqualTo(DBProvider.SqlClient))
                {
                    sql = CreatePagerSql(pager.RecordCount, pager.PageCount, pager.PageIndex, pager.PageSize);
                }
                else if (providerName.IsEqualTo(DBProvider.OracleClient))
                {
                    string orderBy = "";
                    string sort    = " desc";
                    if (ascending)
                    {
                        sort = " asc";
                    }
                    orderBy = primaryKey + sort;
                    sql     = CreatePLSqlByRowNum(pager.PageIndex, pager.PageSize);
                }
            }
            return(sql);
        }