public static DataTable GetTable(PageInfo model) { if (string.IsNullOrWhiteSpace(model.StrSelect)) { model.StrSelect = "*"; } if (model.Config == null) { throw new Exception("Config不能为空!"); } if (string.IsNullOrWhiteSpace(model.StrFrom)) { throw new Exception("StrFrom不能为空!"); } if (string.IsNullOrWhiteSpace(model.StrOrder)) { throw new Exception("StrOrder不能为空!"); } using (var db = new DbBuilder(model.Config)) { string sql = "select count(1) as tcount from (" + model.StrFrom + ") where 1=1 " + model.StrWhere; var recordCount = (int)new DbBuilder(model.Config).GetSingle(sql, model.Parameters); sql = SqlHelper.GetSqlString(model.StrFrom, model.PageSize, model.PageIndex, recordCount, "*", model.StrWhere, model.StrOrder, model.Config); var table = db.GetDataTable(sql, model.Parameters); return(table); } }