|
-
Jan 15th, 2009, 06:26 AM
#1
Thread Starter
Addicted Member
[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
-
Jan 15th, 2009, 07:04 AM
#2
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)
-
Jan 15th, 2009, 07:45 AM
#3
Thread Starter
Addicted Member
Re: How to insert values with decimal in database?
Thank you very much! It's working now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|