在sql查询中返回xml [英] return xml in sql query

查看:112
本文介绍了在sql查询中返回xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我查询返回的xml.

从ProductMaster中选择不同的ProductId,(ProductName),ProductImage,其中XML路径(``product''),root(``ProductInfo'')的ProductName批准的="true"按ProductName排序

它在sql Server Management Studio中显示正确的格式.但是当我将该查询放置在asp.net Web服务中时,它不会显示正确的格式,即数据已损坏.





请帮帮我.
在此先感谢您

Hi,

this is my query for returning xml .

select distinct ProductId, (ProductName),ProductImage from ProductMaster where Approved=''true'' order by ProductName for xml path(''product''),root(''ProductInfo'')

It displays the proper format in sql server management studio. but when i place that query in asp.net web services it won;t displays the proper format i.e the data is broken.





Please help me.
Thanks in advance

推荐答案

您是否使用ExecuteXmlReader从数据库中获取它.
跟随: http://support.microsoft.com/kb/316701 [
Did you use ExecuteXmlReader to get it from database.
Follow : http://support.microsoft.com/kb/316701[^]


这篇关于在sql查询中返回xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆