Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Decimal returning as Integer
Message
From
13/10/2010 10:07:29
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01485249
Message ID:
01485277
Views:
27
>>>In additon, always specify precision when casting to decimal!
>>>
>>>See this blog post
>>>
>>>Always specify precision with decimal and numeric
>>
>>The problem was the precision in my casting, I had left off the (18,2).
>>
>>Thanks
>
>Glad to help.

Aargh! Now it seems to still be coming across to .NET as 70.

This is my code:
            // Create the parameter and set the direction
            Decimal defaultValue = 0.00M;
            IDbDataParameter param1 = this.CreateParameter("@PolicyHeaderPK", policyHeaderFK);
            IDbDataParameter param2 = this.CreateParameter("@SuspenseAmount", defaultValue);
            param2.Direction = ParameterDirection.Output;

            // Call the stored procedure and pass the parameter
            IDbCommand cmd;
            this.ExecSprocScalar("PoliciesGetSuspenseAmount", out cmd, param1, param2);

            // Retrieve the value from the command object
            IDbDataParameter param = (IDbDataParameter)cmd.Parameters["@SuspenseAmount"];
            Decimal suspenseAmount = (Decimal)param.Value;

            return suspenseAmount;
param.Value is definitely 70 whereas the stored procedure is returning 69.57.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform