开发者

Calculation of two fields in ASP.NET (Visual Basic)

I have two money fields in a SQL database called Tot开发者_如何学CalClaimed 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...


shouldn't it be:

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

<>


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜