Click here to Skip to main content
14,356,490 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am implementing a

The Problem is I am doing as Follows

In SQl Statement

when I am Executing
this Formula
select (CONVERT(INT,(12-11)/2)*0.05+0.75)

i am getting out put


but my problem is that when I am implementing the same
Dim frm As Decimal = ((12 - 11) / 2) * 0.05 + 0.75

i am not getting the Same
am getting
as output

but i want the same output as SQL
please assist where i am missing.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

The SQL at
evaluates to 0 which is causing the result to be 0.75. Whearas the statement evaluates the same to 0.5.

If the SQL behavior is the intended then you can use the following code.

Dim frm As Decimal = (CInt((12 - 11) / 2)) * 0.05 + 0.75
Karwa_Vivek 22-Apr-13 8:22am
Thanks for help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100