2
我在我的开发机器中遇到了这个错误。这个错误不会发生在指向相同数据库的其他机器上。绝对两台服务器都不相同。我不知道在一台服务器中丢失了哪些软件会导致此问题。两台机器都运行相同的OS 2008 R2。System.InvalidOperationException:可为空的对象必须有一个值。 Linq to sql
using (MYDB.MyDB oDB = new MYDB.MyDB())
{
var query = from t in oDB.Products
where (_ProductId.HasValue?_ProductId==t.Productid:true)
select new Product()
{
ProductId = t.Productid,
ManufacturerId = t.Manufacturerid,
ManufacturingNumber = t.Manufacturingnumber,
CustomProduct = t.Iscustomproduct ? "Yes" : "No",
IsCustomProduct = t.Iscustomproduct,
SubCategoryName = t.Subcategory.Subcategoryname
};
return query.ToList();
}
任何帮助,高度赞赏
感谢, Senthilkumar