如何将sqlserver数据库转换为xml [英] How to sqlserver database to xml
本文介绍了如何将sqlserver数据库转换为xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想将sqlserver 2008中的数据库转换为xml文件,您可以引导或发送任何代码片段吗?使用SQL Server处理XML,我建议您仔细阅读以下概念:在SQL Server中实现XML [ ^ ]
如果您只是想将查询结果作为XML进行处理,请查看: FOR XML [ ^ ]
此 [ DataTable dt = new DataTable(); SqlDataAdapter广告= 新 SqlDataAdapter(selectCommandText,Connection); ad.Fill(dt); dt.WriteXml(" );
Hello,
My database in sqlserver 2008 i want to convert into xml file can u guide or send any snippets
解决方案
You''re question is a bit unclear but if you want to work with XML using the SQL Server, I''d suggest going through these concepts: Implementing XML in SQL Server[^]
If you simply want to ha the results of a query as XML, have a look at: FOR XML[^]
This[^] is how google works. You can also just write code that shapes the data in to XML manually if you prefer.
DataTable dt = new DataTable(); SqlDataAdapter ad = new SqlDataAdapter(selectCommandText,Connection); ad.Fill(dt); dt.WriteXml("D:\myfile.xml");
这篇关于如何将sqlserver数据库转换为xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文