views:

32

answers:

3

Hi, My data type in database is of type money, the problem is when I save value from user entered input (via a text-box) its not what I expected. Example : string price = "199.99"; in the table it would save as 19999,0000 I tried Convert.ToDecimal("199.99"); and Convert.ToDouble("199.99"); the result is still the same. What sql server dataype should i use for manipulating prices oriented data.

Thanks in advance.

A: 

It somewhat looks like the currency symbol is set to European where the comma delimited the decimals... Is this possible?

Sparky
+2  A: 

The result of converting a string to double and/or decimal are dependent on the locale of your system, where the C# code is running. And the value inserted into the database depends on the type of parameter passed to the database and on the local settings on the backed database server.

So, what are they? Your locale, the type of parameter, the SQL Server server/database/connection settings?

Remus Rusanu
+1  A: 

Personally, I would prefer to use DECIMAL rather than MONEY.

http://is.gd/52ikm

http://is.gd/52ilm

Aaron Bertrand