Seven price
asked on
convert.ToDecimal
yes i have a price text field in which when i add the price it loads into a datagrid. But what i want if a user adds 2.99 ok that shows up but if a user adds 2 i want it to show up as 2.0 but the way i am doing it does not seem to work.
prm = New SqlParameter(@price", SqlDbType.Decimal)
prm.Direction = ParameterDirection.Input
prm.Value = Convert.ToDecimal(me.price.text)
cmd.parameters.Add(prm)
Any suggestions
ASKER
does not work do you know how to use format then (value, "##.00") somthing like this not to sure.
ASKER
prm.Value = Convert.ToDecimal(me.price .text) we have some how get this value to convert me.price.text with 0.0 ToString does not work because we are not really converting to a string this is still numeric.
but if you know the syntex with Format to rerwright this that would help
but if you know the syntex with Format to rerwright this that would help
ASKER
maybe this will help clarify similar to this problem
https://www.experts-exchange.com/questions/21038093/Using-Format-function.html
https://www.experts-exchange.com/questions/21038093/Using-Format-function.html
was the code producing errors? because using format will return a string what language are you using?
ASKER
yes it is like the form cannot add anything
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
prm.Value = Convert.ToDecimal(me.price