I found a post about this exact issue:
http://groups.google.com/group/microsoft.public.dotnet.xml/browse_thread/thread/1dfeb38170cb0b1/ea073666a4035bd5?lnk=st&q=decimal+parse+error+loading+dataset&rnum=6&hl=en#ea073666a4035bd5
but it only shows how to correct the issue manually, not whether it is
a known bug.
My situation is slightly different only in that the xml data and schema
I have are coming directly from the DataSet using:
DataSet.GetXml()
DataSet.GetXmlSchema()
I have a nullable numeric database column: MONTHS
I want to be able to actualy set the value to null in the database.
Here is what I actually get from the DataSet methods above when MONTHS
is null:
DATA: <MONTHS></MONTHS>
SCHEMA: <xs:element name="MONTHS" type="xs:decimal" minOccurs="0" />
If I try to load up a DataSet using DataSet.ReadXml() I get an error as
it tries to parse the decimal value (with enforceconstraints = false).
It doesn't recognize its a nullable element. (see link at the beginning
of this post)
What is apparently required to actually do the load and have the schema
not bark at the data:
DATA: <MONTHS xsi:nil="true"></MONTHS>
SCHEMA: <xs:element name="MONTHS" type="xs:decimal" minOccurs="0"
nillable="true" />
So my question is:
Why do the DataSet methods not apply the "xsi:nil" and "nillable"
attributes for a known nullable element?
Is this a failure of the DataAdpater (I'm using OleDb)?
It does set minOccurs="0" so it knows it is nullable right!
I had to MANUALLY set these attributes on the DATA and SCHEMA as well
as set the "xsi" namespace on the diffgram node to get this to work,
which is NOT acceptable.
If I do a GetXML() and GetSchema() on a DataSet and simply try to load
a data set with that exact information it should not fail.
Known Bug?
Have I missed something obivous?
Any insight would be appreciated as I don't want to have to set these
attributes manually!