O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DataSet + XmlDocument = XmlDataDocument

The previous code snippets used some of the DataSet class’s XML features, but they weren’t terribly exciting. If you’re using these features simply to store the contents of a DataSet in a file and later to read that data back into your DataSet, the fact that ADO.NET is storing the data as XML is irrelevant.

If you’re really interested in working with the contents of a DataSet in XML format, you might want to consider loading the data into an XmlDocument object. This class has a Load method that you can use to load the contents of an XML file, so you could use a DataSet object’s WriteXml method to create your XML file and then call an XmlDocument object’s Load method to load the file. That might sound fine ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required