在intata中将int转换为字符串会引发错误 [英] casting int to string in OData raises error

查看:237
本文介绍了在intata中将int转换为字符串会引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么演员不在这里工作?

why the cast is not working here?

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

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

它说:

类型'System.Int32'和'System.String'之间没有定义强制运算符。

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

推荐答案

OData不支持与字符串之间的转换。它仅支持相关实体类型之间和数字基元类型之间的转换。请参阅 http://msdn.microsoft.com/en -us / library / dd541472(v = PROT.10).aspx 和castExpression段落。
它与C#中的强制转换运算符非常相似。

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.

这篇关于在intata中将int转换为字符串会引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆