OData 查询无法过滤数据

OData query failing at filtering data

我正在尝试通过使用状态不等于 bad 和 poor 且 id= 105 和 id= 106 的过滤器过滤 odata 来获取很少的记录

http://mywebsite.com/testService.svc/Details?$top=10&$filter=(状态ne 'Bad' and Status ne 'poor' and Id eq 105 and Id eq 106)

我的错误是什么,即使有相关记录也显示 0 条记录。我的语法有误吗?

我假设你的 ID 属性 是主键。所以永远不会有一个数据集同时匹配两个 ID 但你正在用 and 搜索它。尝试将您的查询更改为:

http://mywebsite.com/testService.svc/Details?$top=10&$filter=(Status ne 'Bad' and Status ne 'poor' and (Id eq 105 or Id eq 106))