[RESOLVED] How to insert values with decimal in database?
Hi guys,
I have a problem with my sql database. In my database, column Quantity has a data type of decimal. But why everytime I am trying to insert 1.25 in column quantity, and query it the result is 1. Where's 0.25?
My code for asp.net is:
Code:
decimal qty = decimal.Parse(quantity);
And for Stored Procedure:
Do I have to use float instead of decimal?
Thanks very much in advance
Re: How to insert values with decimal in database?
Taking a quick look (as its my lunch now), I think its because you've declared your parameter as DECIMAL and not DECIMAL(10,2) ... so its cutting off your decimal places.
Try declaring the parameter in the stored proc as
Code:
@Quantity DECIMAL(10,2)
Re: How to insert values with decimal in database?
Thank you very much! It's working now.