>>>>>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.
>
>Here you're probably having the same problem. You need to specify type and precision in the param2 line. Verify CreateParameter method and if it allows to specify the type with the precison.
That's a distinct possibility! There is a param.Precision property, but I have no idea how I'm supposed to set it. I'll ask in the MM.NET section and see if I can get a response.