ASP.NET 中两个字段的计算 (Visual Basic)
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不应该是:
<>
shouldn't it be:
<>
你不是在做与你想要的相反的事情吗?您不是从 PartialSettlementAmountRecd 中减去 TotalClaimed 吗?
Aren't you doing the opposite of what you want? Aren't you subtracting TotalClaimed From PartialSettlementAmountRecd?
我很抱歉。我得到的随机数字是由于有人在数据库的“索赔总额”字段中输入了巨大的数字,而我在没有告诉我的情况下进行测试!该代码现在实际上可以处理合理的数字。
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.