带你轻松接触数据库生成xml的两个方法

第一个示例方法:

1 SqlConnection conn = new SqlConnection();

2 conn.ConnectionString = "Server=127.0.0.1;User 

ID=sa;Password=fdahgdrethj31313210212121;

Database=northwind;Persist Security Info=True";

3 conn.Open();

4 SqlDataAdapter da = new SqlDataAdapter("select * from 表", conn);

5 SqlCommandBuilder thisBulder = new SqlCommandBuilder(da);

6 DataSet ds = new DataSet();

7 da.Fill(ds);

8 ds.WriteXml(@"C:	emp.xml"); 数据挖掘交友 

第二个示例方法:

1 private void WriteXmlToFile(DataSet thisDataSet)
2 {
3 if (thisDataSet == null) { return; }
4 // Create a file name to write to.
5 string filename = "myXmlDoc.xml";
6 // Create the FileStream to write with.
7 System.IO.FileStream myFileStream = new System.IO.FileStream
8 (filename, System.IO.FileMode.Create);
9 // Create an XmlTextWriter with the fileStream.
10 System.Xml.XmlTextWriter myXmlWriter =
11 new System.Xml.XmlTextWriter
(myFileStream, System.Text.Encoding.Unicode);
12 // Write to the file with the WriteXml method.
13 thisDataSet.WriteXml(myXmlWriter);
14 myXmlWriter.Close();
15 } 数据挖掘论坛 

(责任编辑:卢兆林)

数据挖掘论坛

Create By Any-Extract(WL-AE)

[数据挖掘专家] [数据挖掘研究院] [数据挖掘论坛] [数据挖掘实验室]
上一篇:详解SQL Server 2008中的联机事务处理
下一篇:如何修改SQL Server 2005 的执行环境
最新评论共有 0 位网友发表了评论 , 查看所有评论
发表评论( 不能超过250字,需审核,请自觉遵守互联网相关政策法规。 )
匿名?
数据挖掘网站导航 数据挖掘论坛导航
  • 数据挖掘工具
  • 数据挖掘论坛
  • DataCruncher - Cognos
  • MineSet - MathSoft
  • Intelligent Miner - GainSmarts
  • Sqlserver - SAS - Clementine
  • CART - Weka - WizSoft
  • NeuroShell - ModelQuest
  • data mining tools - Darwin
  • 数据挖掘交友
  • 数据挖掘博客
  • 数据挖掘工具
  • 数据挖掘资源
  • 数据挖掘技术算法
  • 数据挖掘相关期刊、会议
  • 研究院联盟合作专区
  • 数据挖掘基础与相关技术
  • 数据挖掘厂商与就业
  • 数据挖掘研究者乐园
  • 知名厂商数据挖掘工具资料
  • 国内数据挖掘实验室
  • Foreign Data Mining Lab
  • 热点关注
  • MS SQL "1813"错误产生的原因及解决
  • SQL Server 2005的30个最重要特点
  • SQL Server数据仓库相关概念及构建流程
  • SQL Server 2005 Integration Services - P
  • SQL Server 2005 Integration Services - P
  • SQL Server 2005 Integration Services - L
  • 使用 WebSphere Commerce Analyzer 以关联
  • SQL Server 2005 Integration Services - P
  • SQL Server 2005 Integration Services - P
  • SQL Server 2005 Integration Services - F
  • 论坛最新话题
  • Foundations of Statistical Natural Langu
  • Game Theory meet Data Mining: A Recent P
  • System Building: How does it help or hin
  • 数据挖掘与Clementine培训
  • 新手报到
  • 求 SASEM 客户流失预测分析
  • 数据挖掘工程师/搜索研究院—北京——无线
  • 数据挖掘入门介绍(如何着手数据挖掘)
  • Information Overload Survey Results
  • The INEX 2005 Workshop on Element Retrie
  • 相关资讯
  • SQL Server 2005的30个最重要特点
  • 深入了解SQL Server数据库的线程与纤程
  • 数据挖掘实验室资料
  • 数据挖掘博客地址
  • 数据挖掘实验室网站地址
  • Prepare for Medicare audits by using dat
  • 注册成为SAS用户与爱好者俱乐部会员
  • 水南梅
  • 明日烟
  • 新人报道
  • 下载
  • 厦门服务器托管,450元/月—0592-5177319 高
  • 买空间送域名--0592-5177319 高静