.NET dataset

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I'd like to load xml contents to my dataset from an XML
document in memory. The dataset.ReadXML requires a file
on drive.

Is there a way to do this from xmldoc in memory? Goal is
to use data source to bind xmldoc to datagrid control.
 
Hi!

The dataset has more than one way to read data. One of them is by a
System.IO.TextReader and another with System.Xml.XmlReader. I have never
used the XmlReader, but with the other one you can read the xml from a
string.

DataSet ds = new DataSet();
string myXml = GetXmlData();
ds.ReadXml(new System.IO.StringReader(myXml));

Now the dataset should contain the xml data.

I hope this helps you out!

//Mikael
 
You can load it with a stream of any sort, which negates having to have a
file to load it.

--
Gregory A. Beamer
MPV; MCP: +I, SE, SD, DBA

**********************************************************************
Think outside the box!
**********************************************************************
 
Back
Top