繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> Asp.Net开发 >> Write relational data to an XML file

Write relational data to an XML file

2007-07-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:Write relational data to an XML file Submitted ByUser LevelDate of SubmissionMahesh ChandBeginner03/15/2001 The DataSet class can be used to read a relational database table and write this table t...

Write relational data to an XML file

Submitted ByUser LevelDate of SubmissionMahesh 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 access 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.

责任编辑:admin
相关文章