Loading and Saving Schema Alone

There are times when it is desirable to load or save only the schema portion of a DataSet. For example, you might have the rows of data ready to insert into a DataSet, but you want to make sure that your data conforms to a specific schema from someone else's DataSet. The other person can save their DataSet schema. Then you can take an empty DataSet, load the other person's schema, and then insert your own data. If your data violates the schema in some way, then an exception will be thrown as you enter it into the DataSet.

To load the schema from an XML representation of a DataSet and ignore any other data, call DataSet.ReadXmlSchema(). For example:

C#
l_DataSet.ReadXmlSchema("\XML_DataSet.xml");

VB
l_DataSet.ReadXmlSchema("XML_DataSet.xml")

To write only the schema information for a DataSet to XML, call DataSet.WriteXmlSchema(). For example:

C#
l_DataSet.WriteXmlSchema("\DataSet_SchemaOnly.xml");

VB
l_DataSet.WriteXmlSchema("DataSet_SchemaOnly.xml")

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.65