casting int to string in OData raises error

て烟熏妆下的殇ゞ 提交于 2019-12-12 01:59:31

问题


why the cast is not working here?

http://services.odata.org/Northwind/Northwind.svc/Orders?$filter=startswith(cast(OrderID, 'Edm.String'),'1')

it says:

No coercion operator is defined between types 'System.Int32' and 'System.String'.


回答1:


OData doesn't support conversion to and from string. It supports conversions between related entity types and between numeric primitive types only. See http://msdn.microsoft.com/en-us/library/dd541472(v=PROT.10).aspx and the castExpression paragraph. It's very similar to the cast operator in C# for example.



来源:https://stackoverflow.com/questions/8456013/casting-int-to-string-in-odata-raises-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!