(1)报错情况如下: DoesNotExist: Publisher matching query does not exist. (2)处理方法: try: p = Publisher.objects.get(name='Apress')except Publisher.DoesNotExist: print "Apress isn't in the database yet."else: print "Apress is in the databas
应用背景:以货品为例,在基础数据中配置货品的判断规则,要根据这个规则筛选出符合条件的集合. 创建货品类 public class Product { public string Name { get; set; } public string Code { get; set; } public string Unit { get; set; } } 主要实现方法 public void GetProducts() { #region 创建List 实际应用从数据库中取值 var products