生成多字段排序分页的SQL的通用类

2019-05-12 08:49:26刘景俊

                orderList3 = orderList3.Substring(0, orderList3.Length - 1); 
            } 
            //return orderList2; 
            //形成SQL  
            string strTemp; 
            strTemp = "select * from n ( select top {7} * from ( select top {6} {0} from {1} n"; 
            if (where_ != "") 
                strTemp = strTemp + " where {2} n"; 
            if(orderList!="") 
                strTemp = strTemp + " order by {3} ) as tmp order by {4} n ) n as tmp2 n order by {5} n"; 
            strTemp = string.Format(strTemp, outfields_, table_, where_, orderList, orderList2, orderList3, nowPageIndex_ * pagesize_, pagesize_); 
            return strTemp; 
        } 
        /****************属性*******************/ 
        public string table 
        { 
            set { table_ = value; } 
        } 
        public string where 
        { 
            set { where_ = value; } 
        } 
        public string outfields 
        { 
            set { outfields_ = value; } 
        }