public IEnumerable <Subclass> ClsInfo(string sup, string sub) { StringBuilder sb = new StringBuilder(); sb.Append("select * from subclass where id>0 "); if (!String.IsNullOrEmpty(sup)) { sb.Append(" and supnum=@sup "); } if (!String.IsNullOrEmpty(sub)) { sb.Append(" and subnum=@sub "); } var param = new { sup = sup, sub = sub }; return(dal.QuerySet <Subclass>(sb.ToString(), param)); }