Visual Basic World

Just another Visual Basic weblog

Visual Studio 2005 Cookbook – Database, Reading an XML File into In-Memory Data Tables

Recipe 13.10. Reading an XML File into In-Memory Data Tables

Problem

You previously exported a DataSet to an XML file, and now you need to get it back.

Solution

Use the DataSet object’s ReadXML() method to restore data from a previously generated XML export.

Discussion

Recipe 13.9 exports some XML and a related schema for a table with state-specific information. To read it back into a DataSet object, use the following code:

	Dim stateSet As New Data.DataSet
	stateSet.ReadXmlSchema("c:StateSchema.xml")
	stateSet.ReadXml("c:StateInfo.xml")

You do not need to import a previously saved schema into a DataSet before retrieving the related data, but it helps. Without the schema, Read More >>

July 9, 2008 - Posted by Admin | database, programing, vb.net | , , | No Comments Yet

No comments yet.

Leave a comment

You must be logged in to post a comment.