带你轻松接触数据库生成xml的两个方法计算机等级考试

文章作者 100test 发表时间 2010:01:01 08:39:26
来源 100Test.Com百考试题网


  第一个示例方法:
  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("0select * 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来源:www.100test.com
  (myFileStream, System.Text.Encoding.Unicode).
  12 // Write to the file with the WriteXml method.
  13 thisDataSet.WriteXml(myXmlWriter).
  14 myXmlWriter.Close().
  15 }

  编辑特别推荐:

  2009年9月全国计算机等级考试真题及答案

  2009年9月全国计算机等级考试成绩查询



相关文章


微软SQLServer2008R2八月CTP可供下载计算机等级考试
SQLServer里附加数据库出错的解决方法计算机等级考试
对象关系型数据库管理系统PostgreSQL8.4.1计算机等级考试
解决sqlplus里执行@sql.sql发生的错误现象计算机等级考试
带你轻松接触数据库生成xml的两个方法计算机等级考试
电脑鼠标的正确使用与日常维护指南计算机等级考试
鼠标失灵乱窜的解决办法计算机等级考试
如何正确处理系统不认鼠标的故障计算机等级考试
计算机三级辅导:挑只听话的“老鼠”计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛