Monday, March 19, 2012

convert txt to money data type

Hi,

I'm using the data type "money" in my SQL database and want to convert what's in txtPrice_textBox to the "money" format. I'm currently using the following code:

' objectCym.price = Convert.ToInt16(txtPrice_textBox.Text) '

Will this work? Is there any reason I should stay away from the "Money" data type?

Thanks,

David

I think you can use Money I only advice not using money when you are have precision problems which happens. I think you should change Int16 to decimal and run your code. Try the link below and look at the shopping Cart code for sample code. Hope this helps.

http://asp.net/CommerceStarterKit/docs/docs.htm

|||you can do a convert.todecimal or convert.todouble. AFAIK there is no reason you should stay away from Money types.|||

Thanks for the help,

dp

No comments:

Post a Comment