for xml auto 有关问题?如何在页面显示
for xml auto 问题?怎么在页面显示
用for xml auto 子句得到如下表,但是不能在页面显示,
用ExecuteScalar()方法截断,用什么方法在页显示xml,依然以xml格式
------解决方案--------------------
我知道你什么意思了
不是用ExecuteScalar() 而是用ExecuteXmlReader();
用for xml auto 子句得到如下表,但是不能在页面显示,
- XML code
<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格式
------解决方案--------------------
我知道你什么意思了
不是用ExecuteScalar() 而是用ExecuteXmlReader();
- C# code
System.Xml.XmlReader xr = Command.ExecuteXmlReader(); xr.Read(); while (!xr.EOF) { Response.Write(Server.HtmlEncode(xr.ReadOuterXml())); } xr.Close();