[2008] How do I populate a Strongly Typed DataSet with XML
I am trying to populate a table in a strongly typed dataset used for the ReportViewer.
I want to read in an XML file which was created manually using ds.WriteXML.
The strongly typed dataset has been created to match the structure of the XML file written with ds.WriteXML.
How do I read in the XML file, and populate the table within the dataset used for the ReportViewer?
Re: [2008] How do I populate a Strongly Typed DataSet with XML
If the WriteXml method was used to write the XML, what method do you suppose would be used to read the XML?
Re: [2008] How do I populate a Strongly Typed DataSet with XML
No, you misunderstood.
I AM using ReadXML, but I only seem able to read the XML into a NEW dataset ... I'm just struggling to pass what I've read to the strongly typed dataset.
I can't, for example, use StronglyTypedDataSet.ReadXML(filename).
As a workaround, I've forced the code to dump the designed report bindings in favour of my programmed bindings.
Re: [2008] How do I populate a Strongly Typed DataSet with XML
Really? What happens when you try? I'd have thought that as long as the schemas matched it would be fine. That said, I haven't tested that. Maybe ReadXml tries to discard the existing schema and create a new, although I'd have thought you could control that. Have you read the documentation for the method to see? If you can't then I guess you would have to use two steps. Read the data in first and then populate the DataSet manually. For the first step you could use an XmlReader, an untyped DataSet or an XmlDataDocument.