当前位置: 首页 > news >正文

SQL生成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:\temp.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 } 文章出处:飞诺网(www.firnow.com):http://dev.firnow.com/course/7_databases/sql/sqlServer/20100702/317580.html

相关文章:

  • 丁磊养猪与京东送货的关系
  • jquery代码基
  • 电子技术学习实践DIY
  • 谷歌站长管理工具 -- 方便SEO与恶意软件检测
  • 文件夹的隐藏(五)
  • 【转】串口通信 资源汇总
  • [思想][国粹]《大学 中庸 论语》
  • 从视图查询表分区的相关信息
  • 仓库库存动态分析 手册
  • Linux下关闭远程windows server 2003
  • 哦,高斯!4次乘法变3次的天才。
  • 精彩十年(7)——稍有遗憾的再版
  • ftp术语,ftp错误
  • 使用squid+HAVP+ClamAV 建置防毒 HTTP Proxy
  • 30天敏捷生活:开篇
  • [ 一起学React系列 -- 8 ] React中的文件上传
  • [js高手之路]搞清楚面向对象,必须要理解对象在创建过程中的内存表示
  • android 一些 utils
  • Android组件 - 收藏集 - 掘金
  • CSS实用技巧
  • Django 博客开发教程 8 - 博客文章详情页
  • HTTP那些事
  • iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码
  • JavaScript 事件——“事件类型”中“HTML5事件”的注意要点
  • java多线程
  • windows下如何用phpstorm同步测试服务器
  • 测试如何在敏捷团队中工作?
  • 从零开始学习部署
  • 大整数乘法-表格法
  • 分布式任务队列Celery
  • 搞机器学习要哪些技能
  • 极限编程 (Extreme Programming) - 发布计划 (Release Planning)
  • 将回调地狱按在地上摩擦的Promise
  • 使用putty远程连接linux
  • 手机app有了短信验证码还有没必要有图片验证码?
  • 我的zsh配置, 2019最新方案
  • 学习HTTP相关知识笔记
  • 学习笔记:对象,原型和继承(1)
  • ​​​​​​​Installing ROS on the Raspberry Pi
  • ​七周四次课(5月9日)iptables filter表案例、iptables nat表应用
  • !$boo在php中什么意思,php前戏
  • (11)MSP430F5529 定时器B
  • (4)STL算法之比较
  • (cos^2 X)的定积分,求积分 ∫sin^2(x) dx
  • (C语言)编写程序将一个4×4的数组进行顺时针旋转90度后输出。
  • (二)c52学习之旅-简单了解单片机
  • (附源码)计算机毕业设计SSM基于java的云顶博客系统
  • (六)Hibernate的二级缓存
  • (免费领源码)python#django#mysql校园校园宿舍管理系统84831-计算机毕业设计项目选题推荐
  • (详细版)Vary: Scaling up the Vision Vocabulary for Large Vision-Language Models
  • (转)c++ std::pair 与 std::make
  • 、写入Shellcode到注册表上线
  • . NET自动找可写目录
  • .chm格式文件如何阅读
  • .NET 常见的偏门问题