在 LINQ to DataSet 中链接数据绑定 LINQ 查询
我尝试对查询结果执行查询,但收到错误:“该方法或操作未实现”。我可以用这种方式链接查询吗? 例如,我有一个 Northwind 类型的数据集。我这样做:
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()
我怎样才能做到这一点?
I am trying to perform a query on a query result, but I am getting an error: “The method or operation is not implemented”. Can I chain queries in this way?
For example, I have a Northwind typed DataSet. I do:
queryResult = From product In NorthWindDataSet.Products
Where (product.UnitsOnOrder > CInt(txtUnitsOnOrderFilter.Text))
Select product
Then I try to do
queryResult = From product In queryResult
Where (product.CategoryID = cboCategoryFilter.SelectedValue)
Select product
To finally use result of a query as a binding source:
ProductsBindingSource.DataSource = queryResult.AsDataView()
How can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LINQ to SQL 可能会抱怨查询中的 CInt 和 SelectedValue 调用。尝试在查询之外捕获这些值:
LINQ to SQL is probably complaining about the CInt and SelectedValue calls in your queries. Try capturing those values outside your query instead: