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") ...

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.