Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#sql查询为xml中的元素添加属性_C#_.net_Sql_Sql Server_Xml - Fatal编程技术网

C#sql查询为xml中的元素添加属性

C#sql查询为xml中的元素添加属性,c#,.net,sql,sql-server,xml,C#,.net,Sql,Sql Server,Xml,我想通过从XML\u TAGS表中获取标记,并从MAPPED\u TAGS\u attributes表中获取属性来显示XML文件-类似于: 查询: 结果: <Customers> <Customer Id="1" AccountNumber="X120" /> <Customer Id="2" AccountNumber="X121" /> </Customers> 查询: select c.CustomerId as "@

我想通过从
XML\u TAGS
表中获取标记,并从
MAPPED\u TAGS\u attributes
表中获取属性来显示XML文件-类似于

查询:

结果:

<Customers>
   <Customer Id="1" AccountNumber="X120" />
   <Customer Id="2" AccountNumber="X121" />
</Customers>

查询:

select
    c.CustomerId as "@Id",
    c.AcountNumber as "@AcountNumber"
from Customer c
for xml path('Customer'), root('Customers')
结果:

<Customers>
   <Customer Id="1" AccountNumber="X120" />
   <Customer Id="2" AccountNumber="X121" />
</Customers>


我想通过从xml标签表中获取标签和从映射的标签属性表中获取属性来显示xml文件。。。类似于请添加要使用的表的结构、一些示例数据和预期输出。我想通过从xml标记表中获取标记和从映射的标签属性表中获取属性来显示xml文件。。。例如,请添加要使用的表的结构,一些示例数据和预期的输出。我希望查询从数据库中获取元素和属性。我如何做…1 mediaobject 1 title 1 para 1 pubdate 1 simpara 1 titleabbrev 1 section 1 sect1 1 sect2 1 sect3 1 glossdef NULL NULL xlink:actuate onLoad#隐式NULL xml:lang CDATA#隐式NULLxml:base CDATA#隐式null重新映射CDATA#隐式null xmlns CDATA#已修复“”xlink:actuate none#默示null修订CDATA#默示null供应商CDATA#默示null字号CDATA#默示null xlink:actuate none#默示null外部标签CDATA#添加默示null修订标志#默示null我希望查询从数据库中获取元素和属性..我该怎么做…1 mediaobject 1 title 1 para1 pubdate 1 simpara 1 titleabbrev 1第1节第1节第1节第2节第1节glossdef NULL xlink:actuate onLoad#默示NULL xml:lang CDATA#默示NULL xml:base CDATA#默示NULL重新映射CDATA#默示NULL xmlns CDATA#修复“”xlink:actuate none#默示null修订CDATA#默示null供应商CDATA#默示null字号CDATA#默示null xlink:actuate none#默示null外部标签CDATA#添加默示null修订标志#默示null