Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass string value to type decimal

Status
Not open for further replies.

magmo

Programmer
May 26, 2004
291
0
0
SE
Hi


I have a form that holds a textfield, this textfield get its value from a sql server database, and the datatype for that specifik column is ...

Decimal
Precision: 18
Scale: 2



When I then try to update that value with the textfiled from the form, a value can for example look like this...

125,5

And when I try to insert the value in the database with this ...

MyCommand.Parameters.Add("@Price", SqlDbType.Int, 4).Value = iProductPrice


I get an error telling me.. input value is in wrong format..


Is the SqlDbType wrong or what should I change to get it to work?


Regards
 
Have you tried using SqlDbType.Decimal and casting your value to a decimal before adding it to the parameter?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Hi

I changed it to decimal and also added the Cdec(sString) then it worked.

Thanks for the help!


Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top