成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

Save a DataSet as XML

2010-08-28 10:48:35來(lái)源:西部e網(wǎng)作者:

As shown in the following code, the sample first creates an XmlDataDocument for the DataSet.


 // Load the DataSet with relation data
 DataSet dataset = new DataSet();
 LoadDataSet(dataset);
 // Create an XmlDataDocument for the DataSet
 XmlDataDocument datadoc = new XmlDataDocument(dataset);

This example creates a DataSet using the LoadDataSet function. To ensure the correct loading of the DataSet, the sample displays the DataSet to the screen. The sample then uses the WriteXmlSchema method of the DataSet to write out the schema created by the DataSet. To output the contents of the DataSet as XML, the sample calls the WriteXml method of the DataSet using a file name. Then, the sample reads in the XML that it just wrote and display the data on the screen.


 // Load the DataSet with relation data
 DataSet myDataSet = new DataSet();
 LoadDataSet(myDataSet);

 DisplayTables(myDataSet);

 // Write out schema representation
 myDataSet.WriteXmlSchema(m_SchemaFile);

 // Write out XML data form relational data
 myDataSet.WriteXml(m_XmlFile, XmlWriteMode.IgnoreSchema);

 // Create an XmlDataDocument for the DataSet
 XmlDataDocument datadoc = new XmlDataDocument(myDataSet);

 // Display the XML
 DisplayXMLData(datadoc);


The sample writes the XML data to the file PersonPet.xml. The XML data in XmlDataDocument can now be read with an XmlReader and displayed, showing the XML for the relational data. For more information about reading XML documents, see How do I...Read XML from an XmlDataDocument?.

 

關(guān)鍵詞:DataSetc#

贊助商鏈接:

主站蜘蛛池模板: 竹山县| 雷州市| 临泉县| 宁晋县| 通州市| 久治县| 宜兴市| 鹤岗市| 抚州市| 新乡市| 隆化县| 堆龙德庆县| 松滋市| 黎城县| 湖口县| 岚皋县| 南丰县| 清水县| 响水县| 渭源县| 玉环县| 眉山市| 山东| 永泰县| 夏津县| 江门市| 漳州市| 广东省| 玉溪市| 宜州市| 温泉县| 章丘市| 调兵山市| 荃湾区| 淮阳县| 宜宾县| 华池县| 松潘县| 恭城| 浦县| 炉霍县|