System.FormatException with CSDK 3.50 TC4DE
Posted in 2010
Topics: Connectivity: ODBC / JDBC / .NET
Hey, using IBM Informix .net provider from CSDK 3.50 TC4DE, when i do an ExecuteReader to get an IfxDataReader from a SELECT * FROM .... the fields that are Decimal (DECIMAL(10,2) in db and System.Decimal in IfxDataReader's metadata) throw this System.FormatException whenever you try get the Value. Same code with CSDK 3.00 TC3 works ok. Same code with ODBC data provider to IBM INFORMIX ODBC DRIVER works ok. System.FormatException was unhandled Message="La cadena de entrada no tiene el formato correcto." Source="mscorlib" StackTrace: en System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) en System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt) en System.Decimal.Parse(String s, NumberStyles style) en IBM.Data.Informix.IfxDataReader.GetDecimal(Int32 i) en CIFX.Program.Main(String[] args) en C:\\Proyectos\\DotNet \\SandBox\\CIFX\\CIFX\\Program.cs:línea 37 en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() en System.Threading.ThreadHelper.ThreadStart_Context(Object state) en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) en System.Threading.ThreadHelper.ThreadStart() InnerException: Maybe Sheshnarayan or Premnath still read this find it usefull. Ty.
Changing the Thread's CurrentCulture to Invariant Culture fix this: System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Ty.