我正在尝试对查询结果执行查询,但是我收到错误:“方法或操作未实现”。我可以用这种方式链接查询吗? 例如,我有一个Northwind类型的DataSet。我这样做:
queryResult = From product In NorthWindDataSet.Products
Where (product.UnitsOnOrder > CInt(txtUnitsOnOrderFilter.Text))
Select product
然后我尝试做
queryResult = From product In queryResult
Where (product.CategoryID = cboCategoryFilter.SelectedValue)
Select product
最后将查询结果用作绑定源: ProductsBindingSource.DataSource = queryResult.AsDataView()
我该如何做到这一点?
答案 0 :(得分:0)
LINQ to SQL可能会在您的查询中抱怨CInt和SelectedValue调用。请尝试在查询之外捕获这些值:
Dim units = CInt(txtUnitsOnOrderFilter.Text)
Dim catId = cboCategoryFilter.SelectedValue
queryResult = From product In NorthWindDataSet.Products
Where (product.UnitsOnOrder > units) AndAlso (product.CategoryID = catId)
Select product