Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 946
Kamarey Avatar asked Nov 09 '11 14:11

Kamarey


1 Answers

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

like image 87
Vitek Karas MSFT Avatar answered Nov 10 '22 09:11

Vitek Karas MSFT