how to convert data base data to XML file

2019-05-29 20:12发布

问题:

Q:

I'm a beginner to the XML.I have some data comes from my database, and i wanna to convert these data to XML file,to import it to a specific program later..What are the required steps to do this?Please examples and articles if possible?

need some thing like that ,but dynamically.

回答1:

GetXml() is the function with DataSet to get xml.

DataSet ds = new DataSet();
 // fill dataset from database
ds.GetXml();

Hope will Help.



回答2:

DataSet ds = new DataSet();
ds.Tables.Add("DataTableName");
ds.GetXml();