O'Reilly logo

Microsoft® .NET Compact Framework Kick Start by Ronnie Yates, Erik Rubin

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

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

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