Kamarey
Kamarey

Reputation: 11079

Wcf Data Service: How to handle case insensitive queries

I have a Wcf Data Service (it uses OData protocol) and using this query I want to get all countries, that stars with 'Ca' and this works:

http://localhost/TestService/Data.svc/Countries?$filter=startswith(Name, 'Ca') eq true

But I'm unable to make it work with next query:

http://localhost/TestService/Data.svc/Countries?$filter=startswith(Name, 'ca') eq true

This is auto-complete service for countries and I don't wont to make it case sensitive. Any ideas?

Upvotes: 6

Views: 3274

Answers (1)

Vitek Karas MSFT
Vitek Karas MSFT

Reputation: 13320

You can use tolower (or toupper), for example: /Countries?$filter=startswith(tolower(Name),tolower('Ca'))

Upvotes: 14

Related Questions