Write relational data to an XML file

发表于:2007-06-30来源:作者:点击数: 标签:
Write relational data to an XML file Submitted By User Level Date of Submission Mahesh Chand Beginner 03/15/2001 The DataSet class can be used to read a relational database table and write this table to an XML file. You use WriteXMLData or
Write relational data to an XML file
Submitted ByUser LevelDate of Submission
Mahesh ChandBeginner03/15/2001

The DataSet class can be used to read a relational database table and write this table to an XML file. You use WriteXMLData or WriteXml class to write a DataSet data to an XML file.
In this sample example, I have used aclearcase/" target="_blank" >ccess 2000 database, mydb.mdb. This database has a table, myTable.
ADODataSetCommand adoCmd = new ADODataSetCommand( "SELECT * FROM myTable", "Provider=Microsoft.JET.OLEDB.4.0;data source=mydb.mdb" );
DataSet ds = new DataSet();
adoCmd.FillDataSet(ds,"myTable");
ds.WriteXmlData("reldata.xml");

WriteXmlData method takes one parameter and that is XML file name which stores the data from the database.

原文转自:http://www.ltesting.net