Using XML and ADO.NET under .NET (Out to ADO.NET Technology)

xiaoxiao2021-03-06  62

1. xml of DataSet object

You can directly convert the data in the DataSet to XML, how to use:

DataSet DS = New DataSet ();

//...Fill DS

DS.GETXML ​​(); // Transform to XML

2.WriteXML and READXML method:

WriteXML can write DataSet content to a file or a STREAM, TextWriter, or XMLWriter to object, such as:

DataSet DS = New Dataset ();

//....Fill DS

String strpathtoxml = "c: //mydata.xml";

DS.WRITEXML (STRPATHTOML, XMLWRITEMODE.WRITESCHEMA) // Write and file with data in DataSet

Shdocvw.interneTexplorer IE = new shdocvw.internetExplorerClass ();

Object Objectempty = Type.Missing;

IE.NAVIGATE (StrPathtoxml, Ref Objectempty, Ref Objectempty, Ref Objectempty);

IE.visible = true; // Show this XML file with IE

The READXML method is to read XML data into the DataSet, which is the reverse operation of WriteXML.

Continue ...

转载请注明原文地址:https://www.9cbs.com/read-83306.html

New Post(0)