SQL 数据服务 - 查询 null

发布于 2024-07-14 09:00:09 字数 807 浏览 6 评论 0原文

(这与 Microsoft 的 SitkaSoapService 相关,位于 https://database.windows.net/soap 的服务参考中/v1/)

我正在使用 SitkaSoapServiceClient 通过 SOAP 访问我的 SQL Data Services 数据库。

我可以通过在字符串中传递 linq 语句来查询数据,例如:

Scope scope = new Scope();
scope.AuthorityId = authorityId;
scope.ContainerId = containerId;

using (SitkaSoapServiceClient proxy = GetProxy())
    return proxy.Query(scope, "from e in entities where e[\"FirstName\"] == \"Bob\" select e");

但是,我无法弄清楚如何查询空属性值(即查找没有该属性的实体)。

我希望能够说:

return proxy.Query(scope, "from e in entities where e[\"FirstName\"] == null select e");

...但这会引发 FaultException<>,说“找不到名称 'null'”

有什么想法吗?

(This relates to Microsoft's SitkaSoapService, in the service reference at https://database.windows.net/soap/v1/)

I'm using SitkaSoapServiceClient to access my SQL Data Services database by SOAP.

I can query data by passing a linq statement in a string, such as:

Scope scope = new Scope();
scope.AuthorityId = authorityId;
scope.ContainerId = containerId;

using (SitkaSoapServiceClient proxy = GetProxy())
    return proxy.Query(scope, "from e in entities where e[\"FirstName\"] == \"Bob\" select e");

However, I can't figure out how to query for a null property value (i.e. find entities without that property).

I'd expect to be able to say:

return proxy.Query(scope, "from e in entities where e[\"FirstName\"] == null select e");

... but that throws a FaultException<>, saying "The name 'null' could not be found"

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

下壹個目標 2024-07-21 09:00:09

您可以像这样检查 not null:

where e["FirstName"] >= ""

因此 null 检查变得:

where !(e["FirstName"] >= "")

有点令人讨厌,但它有效。 也许有更好的方法,但我找不到......

You can check for not null like this:

where e["FirstName"] >= ""

so the null check becomes:

where !(e["FirstName"] >= "")

A bit nasty, but it works. Maybe there's a better way, but I can't find it...

风吹雪碎 2024-07-21 09:00:09

我不熟悉您正在尝试的服务,但 T-SQL 需要类似的东西:

return proxy.Query(scope, "from e in entities where e[\"FirstName\"] IS null select e");

I'm not familiar with the service you are trying but T-SQL would want something like:

return proxy.Query(scope, "from e in entities where e[\"FirstName\"] IS null select e");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文