根据数据库生成xml二法
类别: ASP.NET教程
SqlConnection conn = new SqlConnection();
= \"Server=127.0.0.1;User ID=sa;Password=fdahgdrethj31313210212121;Database=northwind;Persist Security Info=True\";
= new SqlDataAdapter(\"select * from 表\", conn);
= new SqlCommandBuilder(da);
= new DataSet();
@\"C:/temp.xml\");
= \"Server=127.0.0.1;User ID=sa;Password=fdahgdrethj31313210212121;Database=northwind;Persist Security Info=True\";
= new SqlDataAdapter(\"select * from 表\", conn);
= new SqlCommandBuilder(da);
= new DataSet();
@\"C:/temp.xml\");
private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = \"myXmlDoc.xml\";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter);
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = \"myXmlDoc.xml\";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter);
- 上一篇: asp.net生成静态页
- 下一篇: Render方法生成静态页
-= 资 源 教 程 =-
文 章 搜 索