快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

根据数据库生成xml二法

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\");
\"\"
\"\"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);   
\"\"\"\"

返回类别: 教程
上一教程: 利用asp+的独特的底层操作的功能实现对Pop服务器的存取(实现了asp+收pop信件的功能)
下一教程: .NET和SQL Server中“空值”辨析

您可以阅读与"根据数据库生成xml二法"相关的教程:
· .NET Remoting 实现分布式数据库查询
· ADO连接数据库字符串大全
· ASP+联结数据库
· 使用ADO.NET轻松操纵数据库
· asp+ 利用数据绑定来处理XML文件
    微笑服务 优质保证 索取样品