Question

(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?

Was it helpful?

Solution

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...

OTHER TIPS

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");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top