XmlDataDocument, DataSet and multiple LoadXml()

F

Franz Gsell

Hi together,

I have got a DataSet which is bound to a XmlDataDocument object. Now I
want to call LoadXml() multiple times to populate the DataSet object.
For better understanding here are some code fragments:


DataSet actDataSet = new DataSet();
actDataSet.ReadXmlSchema("MySchema.xsd");
XmlDataDocument actDocument = new XmlDataDocument(actDataSet);


public void SomeEventFired(XmlNode dataNode)
{
// Populate the DataSet
actDocument.LoadXml(dataNode.OuterXml);
}


So now my problem is that on the first call of SomeEventFired everything
is fine. But when I call SomeEventFired once more than I get an
InvalidOperationException (Cannot load XmlDataDocument if it already
contains data. Please use a new XmlDataDocument.)

So how can I populate my DataSet multiple times with different Nodes??

Kind regards,
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top