ASP.NET 中两个字段的计算 (Visual Basic)

发布于 2024-10-10 17:10:45 字数 525 浏览 3 评论 0原文

我在 SQL 数据库中有两个货币字段,名为 TotalClaimed 和 PartialSettlementAmountRecd。

它们被声明为小数,如下所示:

Public PartialSettlementAmountRecd As Decimal
Public TotalClaimed As Decimal

它们都完美地输出各自的数量。我需要对它们进行计算,从 TotalClaimed 中减去 PartialSettlementAmountRecd。我已经尝试过以下操作,但它只是输出一个随机数,而不是我需要的数量。

Dim NewSettAmount As Decimal =  (ClaimDetail.TotalClaimed) - (ClaimDetail.PartialSettlementAmountRecd)
Response.Write("New Settlement Amount: £" & NewSettAmount)

我哪里出错了?谢谢...

I have two money fields in a SQL database called TotalClaimed and PartialSettlementAmountRecd.

They are declared as Decimals like so:

Public PartialSettlementAmountRecd As Decimal
Public TotalClaimed As Decimal

They both output the repsective amounts perfectly. I need to do a calculation on them, by subtracting PartialSettlementAmountRecd from TotalClaimed. I have tried the following, but it just outputs a random number, not the amount I require.

Dim NewSettAmount As Decimal =  (ClaimDetail.TotalClaimed) - (ClaimDetail.PartialSettlementAmountRecd)
Response.Write("New Settlement Amount: £" & NewSettAmount)

Where am I going wrong? Thanks...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

塔塔猫 2024-10-17 17:10:45

不应该是:

Dim NewSettAmount As Decimal = (ClaimDetail.TotalClaimed) - (ClaimDetail.PartialSettlementAmountRecd)

<>

shouldn't it be:

Dim NewSettAmount As Decimal = (ClaimDetail.TotalClaimed) - (ClaimDetail.PartialSettlementAmountRecd)

<>

节枝 2024-10-17 17:10:45

我需要对它们进行计算,从 TotalClaimed 中减去 PartialSettlementAmountRecd

(ClaimDetail.PartialSettlementAmountRecd) - (ClaimDetail.TotalClaimed)

你不是在做与你想要的相反的事情吗?您不是从 PartialSettlementAmountRecd 中减去 TotalClaimed 吗?

I need to do a calculation on them, by subtracting PartialSettlementAmountRecd from TotalClaimed

(ClaimDetail.PartialSettlementAmountRecd) - (ClaimDetail.TotalClaimed)

Aren't you doing the opposite of what you want? Aren't you subtracting TotalClaimed From PartialSettlementAmountRecd?

天暗了我发光 2024-10-17 17:10:45

我很抱歉。我得到的随机数字是由于有人在数据库的“索赔总额”字段中输入了巨大的数字,而我在没有告诉我的情况下进行测试!该代码现在实际上可以处理合理的数字。

I apologise. The random figures I was getting were due to somebody entering a huge number in the Total Claimed field in the database whilst I was testing without telling me! The code actually works now with sensible figures.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文