Decimal precision lost when using stored procedure with output parameters RRS feed

  • Question

  • I have a stored procedure that uses output parameters like this:

    ALTER PROCEDURE [GetAmount] 
    @orderID [int], 
    @totalcost decimal(18,2) OUTPUT 
    SELECT @cost = cost 
    FROM mytable 
    WHERE orderID = @orderID 

    When I drag the stored procedure onto the designer, the resulting code in the designer.cs file ends up losing the precision, like this:
    [Parameter(DbType="Decimal")] ref System.Nullable<decimal> totalcost  

    Now, I can manually correct the .cs file, but I'd have to remember to do it every time an update is made.  Am I doing something wrong?  Is there a way to change my stored procedure that would enable LINQ to automatically detect precision? 

    Tuesday, January 6, 2009 4:23 PM