views:

496

answers:

2

How is it possible for this to be true

XmlDocument d = BuildReportXML(schema);
DataSet ds = new DataSet();
ds.ReadXmlSchema(schema);
ds.ReadXml(new XmlNodeReader(d));

schema is the schema location that I apply to the xmldocument before I start setting data, assuring that all the columns are of the correct type. Then I set the schema to the dataset, and read the document into it. When I do this it throws an "Input string was not in a correct format." I have a few decimal variables in the xml, and I assume this is the error. All of the information is obviously of the correct format, else the xmldocument would have errored. What can I do??

A: 

FxCop recommends always setting the locale of a DataSet. e.g.:

ds.Locale = CultureInfo.InvariantCulture;

Could it be that the locale of your DataSet does not match the Xml you are reading?

Joe
+1  A: 

Does the xml document contain empty values in the double? this could be an issue!

Also I remember reading about same name used in as root element , element and attribute causing issue.. Not sure if it is fixed in some service pak.. so try making all these names different!

msreekm