0

I upgrading .NET Framework 2 application in Windows Server 2003 to .NET Framework 4.5.1; and Oracle Database 10g to 12g.

Currency values are stored in database as Number(12,2) e.g. value 416.67

After framework upgradation and deployment the values displays 41.667,00 instead of 416,67

Please note that globalization values are culture="it-IT" uiCulture="it-IT" and the conversion is done using following code

CType(dbCommand.Parameters.Item("column").Value.ToString(), Double)

I know that the conversion to 416.67 to 41667.0 is correct under the culture="it-IT" but I wonder how this were working correctly in previous Windows 2003 server? I don't have access to that server.

Please let me know how to solve this issue.

Sandeep Kumar M
  • 3,841
  • 3
  • 38
  • 59
  • The old behavior was arguably incorrect. Have you considered fixing the actual problem? Removing the `.ToString()` should do, assuming the statement returns the number as a `DECIMAL` and not a character type. – Jeroen Mostert Feb 25 '15 at 06:58
  • @JeroenMostert - I tried `(CType(dbCommand.Parameters.Item("out_imp_compenso").Value, Decimal))` and it throws error 'OracleDecimal' to type 'Decimal' is not valid. – Sandeep Kumar M Feb 25 '15 at 07:20
  • read this : https://community.oracle.com/thread/2155678 – CristiC777 Feb 25 '15 at 07:24
  • Display formats are not stored in the database, that's up to the query or the GUI front end to determine. – CristiC777 Feb 25 '15 at 07:26
  • and also check into your database after conversion to see what value is in that field. and post :) – CristiC777 Feb 25 '15 at 07:33
  • http://stackoverflow.com/questions/1906361/oracle-number-to-c-sharp-decimal might be useful. It suggests the use of `OracleDecimal.SetPrecision` to enable conversion to a decimal directly (with no string intermediates to gum up the works). – Jeroen Mostert Feb 25 '15 at 07:54

0 Answers0