I am trying to get data from an IBM Database using the IfxDataReader like this:
Using myCon As New IfxConnection("CONSTRING")
Dim myQuery = "SELECT decimalValue FROM exampletable"
Using myCmd As New IfxCommand(myQuery, myCon)
myCon.Open()
Using myReader As IfxDataReader = myCmd.ExecuteReader
While myReader.Read
' error occurs below
Dim myVariable As Double = myReader("decimalValue")
End While
End Using
End Using
End Using
I receive a System.FormatException at myReader("decimalValue")
. Hovering my mouse over this piece of code during dubugging, will also show me this exception, even before executing the line of code. The exception has the following stack trace.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)
at IBM.Data.Informix.IfxDataReader.GetSytemTypeFromCacheType(Type systemType, Type cacheEntryType, Object cacheEntry)
at IBM.Data.Informix.IfxDataReader.GetValue(Int32 i)
at IBM.Data.Informix.IfxDataReader.get_Item(String value)
I am using Imports IBM.Data.Informix
in my file and have a reference to a DLL with the same name in my project. The DLL's file version is 4.0.1000.2
and its product version is 4.00.01000.2
.
I have found this similar-looking problem, but checking the mentioned box here, did not do the trick. Dim b As Integer = Integer.Parse("1") resulting in "System.FormatException: 'Input string was not in a correct format.'"
Apparently this issue only occurs on my own pc. I have executed the exact same code on the Computers of two of my colleagues, as well as one of our servers, and none of them get the issue.
At first I though it something to do, with me not having an Informix Client SDK installed, as I have found a similar issue described on ibm.com which suggest updating the SDK: https://www.ibm.com/support/pages/apar/IC60254 But after installing an SDK it stilled didn't work and I also found out, that it works on the PC of a colleague who has no SDK installed. Therefore I am stumped, not having any clue as to why this issue occurs, on why only for me.
Does anyone have a clue, what might be causing this error?