I’m receiving from the Oracle database the following value (as varchar): 7876,72
In Visual Studio it’s read as a String
CASE 1 (expected case):
When I’m debuggin I see: 7876.72 and when I try to Convert.ToDecimal("7876.72") I’m getting 7876.72D
CASE 2 (wrong case):
When I’m debuggin I see: 7876,72 and when I try to Convert.ToDecimal("7876,72") I’m getting 787672D
I’m checking the CultureInfo.CurrentCulture and RegionInfo.CurrentRegion and it’s the same on both machines…
The main reason of this is because:
Convert.ToDecimal("7876,72").ToString("0,0.00", CultureInfo.InvariantCulture) gives me: 787,672.00 and it should be 7,876.72.
Global.asax – Application_Start
Dim newCulture As CultureInfo = DirectCast(System.Threading.Thread.CurrentThread.CurrentCulture.Clone(), CultureInfo)
newCulture.DateTimeFormat.ShortDatePattern = "yyyy/MM/dd"
newCulture.DateTimeFormat.DateSeparator = "/"
newCulture.NumberFormat.CurrencyDecimalSeparator = "."
newCulture.NumberFormat.NumberDecimalSeparator = "."
Thread.CurrentThread.CurrentCulture = newCulture
Any ideas on how to keep the same value on both machines?
Thanks in advance!
The problem was with the Oracle client, I had some inconsistency between my developer machine and the server machine, that was the main reason why the dates and the decimal values where showing differente on both machines.
The solution was forcing both machines to behave the same way, and to do that we changed the key of the Oracle client and added the needed parameters:
Hope it helps someone else.