NaN (Not a number) and DataSet

  • Thread starter Thread starter Magne Ryholt
  • Start date Start date
M

Magne Ryholt

I have a typed dataset with a field (represented as an xml attribute) of
type float (xs:float).
The value is at some point float.NaN (Not a number).

I do: myDataSet.WriteXml(theNameOfTheXmlFile, XmlWriteMode.IgnoreSchema);
In the xml file, this is now represented as: MyNameSpacePrefix:MyFloat="NaN"

So far so good, but when I try to read this xml file into the dataset later,
by: myDataSet.ReadXml(theNameOfTheXmlFile, XmlReadMode.IgnoreSchema);
a System.FormatException (additional text: Input string was not in a correct
format) is thrown due to this "NaN".

Anyone knows if it is possible (and how) to read back a "NaN" from an xml
file and make it be represented as float.NaN ?
 
I don't read from a database, but from an excel sheet which I have no
control over.
This excel sheet has a mix of empty cells and cells with float numbers and I
need a way to represent an empty cell.
Further I need to store the values in xml (by using the beforementioned
methofs around DataSet.
I cannot use 0.0 as representation of an empty cell because this would be a
perfectly legal value and semantically different from an empty cell.
 
Back
Top