Mapping between SqlDbType.double and SQLServer's money?

Oct 18 2004 4:09 AM
Hi all, I have a question concerning a strange behaviour that I noticed. From my C# code (.Net 1.0) I call a stored procedure that basically sums up a numeric database field of type money and returns the sum to my application. In the code, the parameter type is set to SqlDbType.double. For some reason, the database sum is rounded up when being passed back to the calling assembly. For example, if the sum on database equals 978.53, this suddenly becomes 979.00 for the code. When I change the parameter type to SqlDbType.Money in my code, it seems to work fine. When writing to database, SqlDbType.double in code and money type on SQLServer does not cause any rounding problems. Any idea what is causing this problem?

Answers (1)