LinqToSql PredicateBuilder 如何检索最后插入的值
我有两个表
Table Products
-ID
-Name
-Description
...
,
Table Price
-ProductID
-Price
-DateAdded
如何创建一个谓词,我们将返回价格大于 10 的产品列表
我尝试了以下查询,
Dim predInner As Expression (Of System.Func (Of tblProduct, Boolean)) = PredicateBuilder.True (Of tblProduct) ()
predInner = predInner.And (Function (a As tblProduct) a.tblPrice.Select (Function (c) c.Price). First ()> 10)
pred= pred.And (predInner)
Me.Grid.DataSource = vQuery.Where (pre)
但并不总是返回最后插入的值。这部分是否可以
a.tblPrice.Select (Function (c) c.Price). First ()
通过某种方式按 DateAdded 列排序
I have two tables
Table Products
-ID
-Name
-Description
...
And
Table Price
-ProductID
-Price
-DateAdded
How do I create a Predicate which we will return the list of products whose price is greater than 10
I tried the following query
Dim predInner As Expression (Of System.Func (Of tblProduct, Boolean)) = PredicateBuilder.True (Of tblProduct) ()
predInner = predInner.And (Function (a As tblProduct) a.tblPrice.Select (Function (c) c.Price). First ()> 10)
pred= pred.And (predInner)
Me.Grid.DataSource = vQuery.Where (pre)
but not always return the last inserted value. Is it possible for this part
a.tblPrice.Select (Function (c) c.Price). First ()
in some way to sort by column DateAdded
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论