我正在尝试基于从LINQ查询返回的已填充文本框的数量来构建一个sql insert查询。让我感到困惑的问题是如何将填充的文本框的值添加到insert查询内的命名参数中,而不会出现number of query values and destination fields are not the下面是我准备好的代码:
// use LINQ to
db.Items.Where(x=>x.CategoryId==categoryId);where CategoryId=nullwhere CategoryId is nullvar items=db.Items.Where(x=>x.CategoryId==null);where CategoryId is null
但是当我这样做的时候
我的问题是,如果我将从linq查询返回的空集加载到自定义类中,我该如何处理它。this.Section = section; this.Event = event;}
目前,这个查询非常有效,直到结果集为空,然后我得到:"Object reference not set to a instance of an object“。如果结果集为空,我需要查询</e