这是什么类型:ISNULL(SUM(COALESCE(a.currency,0)),0)(What type is this: ISNULL(SUM(COALESCE (a.currency, 0))

编程入门 行业动态 更新时间:2024-10-27 01:30:17
这是什么类型:ISNULL(SUM(COALESCE(a.currency,0)),0)(What type is this: ISNULL(SUM(COALESCE (a.currency, 0)), 0))

我有以下一段sql查询:

Sql += " SELECT ISNULL(SUM(COALESCE (a.currency, 0)), 0) AS monthCurrency FROM IW_Awards AS a ";

查询工作正常,我试图在提交查询后在C#中转换此值,我找不到它的类型。

我试过int,int? 和字符串。 当我尝试强制转换为字符串时,我遇到以下错误消息: 无法将类型为“System.Decimal”的对象强制转换为“System.String”。

当我试图将它转换为Int或Int时? 我得到: 指定的演员表是无效的。

数据库:SQL IDE:Visual Studio 2010数据库接口:LINQ(但我正在创建自己的查询)服务器端语言:C#

感谢您的帮助。

I have the following piece of sql query:

Sql += " SELECT ISNULL(SUM(COALESCE (a.currency, 0)), 0) AS monthCurrency FROM IW_Awards AS a ";

The query works fine, I am trying to cast this value in C# after the query has been submitted and I cannot find what type it is.

I tried int, int? and string. When I tried to cast to a string I had the following error message: Unable to cast object of type 'System.Decimal' to type 'System.String'.

And when I tried to cast it to an Int or Int? I got: Specified cast is not valid.

Database: SQL IDE: Visual Studio 2010 Database interface: LINQ (but I am creating my own query) Server side language: C#

Thank you for your help.

最满意答案

你试过十进制吗? 它告诉你它试图将System.Decimal强制转换为字符串,当你试图将它转换为字符串时。

它将返回货币的任何类型。

Did you try decimal? It told you it was trying to cast a System.Decimal to a string when you tried to cast it to a string.

It will return whichever type Currency is.

更多推荐

本文发布于:2023-08-07 22:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466034.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   这是什么   ISNULL   SUM   currency

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!