用for xml auto 子句得到如下表,但是不能在页面显示,
<test ID="1" col1="1" col2="b" col3="1" />
<test ID="2" col1="1" col2="c" col3="4" />
<test ID="3" col1="1" col2="a" col3="9" />
<test ID="4" col1="1" col2="b" col3="16" />
<test ID="5" col1="1" col2="c" col3="25" />
<test ID="6" col1="1" col2="a" col3="36" />
<test ID="7" col1="1" col2="b" col3="49" />
用ExecuteScalar()方法截断,用什么方法在页显示xml,依然以xml格式
<test ID="1" col1="1" col2="b" col3="1" />
<test ID="2" col1="1" col2="c" col3="4" />
<test ID="3" col1="1" col2="a" col3="9" />
<test ID="4" col1="1" col2="b" col3="16" />
<test ID="5" col1="1" col2="c" col3="25" />
<test ID="6" col1="1" col2="a" col3="36" />
<test ID="7" col1="1" col2="b" col3="49" />
用ExecuteScalar()方法截断,用什么方法在页显示xml,依然以xml格式
解决方案 »
- IE里可以运行 火狐里就不执行Jquery代码呢
- ~~~~~~jQuery tipswindown.js 弹出后 层里面的控件失效~~~~~~我想问这是为什么,用过的高手进来指点下
- Aspnet_regsql 启用后的问题,~~高手请进~~,速度结贴!
- 有关listbox ~!
- 帮大姐个忙,在c#+asp.net的解决方案中用*.js文件要做注册吗?
- 图像处理功能疑惑,请指教!
- 在一个多框架页面中,怎么在程序中实现关掉这些框架页面,或转向另一个页面
- ASP.NET网页弹出警告框怎么做?
- 有关于模版列的问题
- 关于组件和控件的问题。
- LinkButton突然失效,高手指教!
- FCKeditor上传不同文件夹问题?
<?xml-stylesheet type="text/xsl" href="XSLTFile1.xslt"?>
<t>
<test ID="1" col1="1" col2="b" col3="1" >a</test>
<test ID="2" col1="1" col2="c" col3="4" >b</test>
<test ID="3" col1="1" col2="a" col3="9" >c</test>
<test ID="4" col1="1" col2="b" col3="16" >d</test>
<test ID="5" col1="1" col2="c" col3="25" >e</test>
<test ID="6" col1="1" col2="a" col3="36" >f</test>
<test ID="7" col1="1" col2="b" col3="49" >g</test>
</t>
XSLTFile1.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
我知道用dataTable.WriteXml() 方法可以实现xml页面输出。我想实现在页面显示如下形式<?xml version="1.0" encoding="utf-8" ?>
<t>
<test ID="1" col1="1" col2="b" col3="1" >a</test>
<test ID="2" col1="1" col2="c" col3="4" >b</test>
<test ID="3" col1="1" col2="a" col3="9" >c</test>
<test ID="4" col1="1" col2="b" col3="16" >d</test>
<test ID="5" col1="1" col2="c" col3="25" >e</test>
<test ID="6" col1="1" col2="a" col3="36" >f</test>
<test ID="7" col1="1" col2="b" col3="49" >g</test>
</t>
怎么实现?但不是这样的显示
<?xml version="1.0" encoding="UTF-8" ?>
- <DocumentElement>
- <test>
<ID>1</ID>
<col1>1</col1>
<col2>b</col2>
<col3>1</col3>
</test>
- <test>
<ID>2</ID>
<col1>1</col1>
<col2>c</col2>
<col3>4</col3>
</examList>
- <test>
<ID>3</ID>
<col1>1</col1>
<col2>a</col2>
<col3>9</col3>
</test>
- <test>
<ID>4</ID>
<col1>1</col1>
<col2>b</col2>
<col3>16</col3>
</test>
</DocumentElement>
不是用ExecuteScalar() 而是用ExecuteXmlReader();System.Xml.XmlReader xr = Command.ExecuteXmlReader();
xr.Read();
while (!xr.EOF)
{
Response.Write(Server.HtmlEncode(xr.ReadOuterXml()));
}
xr.Close();