• --:)欢迎访问锋网源码(:--
  • 首页
  • RSS订阅
  • 常用软件
  • 网页模板
  • 网站运作
  • 锋网学院
  • 繁體中文

  • 学院首页
  • 新闻资讯
  • 网站运营
  • 网站开发
  • 美工设计
  • 数据库类
  • 服务器类
  • 网络应用
  • 操作系统
  • 软件教学
编程开发   认证考试   网络安全   文章搜索: 高级搜索
会员登录/控制面版 您的位置: 学院首页 >> 网站开发 >> xml教程 >> 文章内容
 

精彩推荐

 
 

本类推荐文章

 
 

本类阅读排行

  • XML DOM介绍和例子(一)
  • 把ASP移植到ASP+
  • XML DOM介绍和例子(三)
  • 利用XMLBean轻轻松松读写XML
  • XML DOM介绍和例子(二)
  • XML轻松学习手册(2)XML概念..
  • XSLT document()函数在IE与F..
  • xslt的简单使用[xml-->html]..
  • 数据库生成xml的简单方法
  • XML 增、删、改和查示例
  • 使用 XML 文件记录操作日志
  • 历数Firefox2.0对XML处理的改..
  • XML教程:通过一个例子来学习..
  • 从xml中获取城市,省份名称
  • XML与HTML的结合(上)
  • 了解WEB页面工具语言XML(五)..
  • Xml_javascript分页
  • 在 XSL/XSLT 中实现随机排序
  • XML轻松学习手册(1)XML快速..
  • 用XML数据岛结合Dom制作通讯..
 
 

数据库生成xml的简单方法

  • 日期:2008-01-28     人气:     出处:本站     作者:
  • 字体大小:
  • 小
  • 中
  • 大

第一个示例方法:

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

Webjx.Com

8 ds.WriteXml(@"C:\temp.xml");

Webjx.Com

第二个示例方法: Webjx.Com

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 }

相关文章
  • 轻松修复Discuz!数据库
  • 网站在搜索引擎里的排名靠前的简单方法
  • 触发器对SQL Server数据库进行备份
  • 安全打开U盘目录的简单方法
  • 简单方法查找攻击者的老巢
  • JSP教程:tomcat配置数据库连接池
  • SQL Server2000数据库分离与附加
  • MySQL数据库复位根用户的密码
  • SQL Server系统数据库的工作原理
  • 深入了解Oracle数据库后台进程的功能
相关软件

  • 网友评论:
  • 查看所有评论
  • 我要发表评论
 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 加入收藏 | 帮助中心 |

Copyright © 2006-2007 fwvv.net  程序支持:木翼  皖ICP备06004916号  

感谢:点击网络 联网科技 天盈信息 中国E速网 59互联  提供服务器及带宽赞助