public abstract OperateResultModel Query(string tablename, List <DBMemberEntity> entities, string orderby, PaginModel pm);
public override OperateResultModel Query(string tablename, List <DBMemberEntity> entities, string orderby, PaginModel pm) { string strSQL = "select count(0) from {0} {1};{2} select * {3} from {0} {1} {4}"; string format2 = ""; string format3 = ""; string format4 = ""; if (pm != null) { format2 = "select aa.* from("; format3 = ",row_number() over(order by " + orderby + ") row_no"; format4 = ") aa where aa.row_no between {0} and {1}"; format4 = string.Format(format4, pm.startpos, pm.endpos); } else { if (!string.IsNullOrEmpty(orderby)) { format4 = " order by " + orderby; } } string condition = DbConditionSqlBuilder(entities); DataSet ds = Query(string.Format(strSQL, tablename, condition, format2, format3, format4), entities); OperateResultModel orm = new OperateResultModel(); orm.total = Convert.ToInt32(ds.Tables[0].Rows[0][0]); orm.success = true; orm.rows = ds.Tables[1]; return(orm); }