Agamand The True
Agamand The True

Reputation: 832

Sql server 2005 data type

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.

Upvotes: 1

Views: 292

Answers (3)

Aaron Bertrand
Aaron Bertrand

Reputation: 280570

Personally, I would prefer to use DECIMAL rather than MONEY.
See these two posts on sqlblog.

Upvotes: 1

Remus Rusanu
Remus Rusanu

Reputation: 294427

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?

Upvotes: 2

Sparky
Sparky

Reputation: 15105

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

Upvotes: 0

Related Questions