Dim pth As String = "bin/" + usern + "/" + usern + ".xml"
Dim objConn As SqlConnection
Dim strSql As String
strSql = "SELECT * FROM test"
objConn = New SqlConnection(ConfigurationManager.AppSettings("scon"))
Dim sdaCust As New SqlDataAdapter(strSql, objConn)
Dim dstCust As New DataSet()
sdaCust.Fill(dstCust, "test")
dstCust.WriteXml(Server.MapPath(pth))
我用上面的方法生成xml文件
?xml version="1.0" encoding="GB2312"?>
<NewDataSet>
<test>
<id>3</id>
<usern>koko</usern>
<mima>koko</mima>
</test>
<test>
<id>19</id>
<usern>logo</usern>
<mima>logo</mima>
</test>
</NewDataSet>
那么有什么方法在sql转换xml时候<?xml version="1.0" standalone="yes"?>变为
<?xml version="1.0" encoding="GB2312"?>便于通过xsl显示成html
Dim objConn As SqlConnection
Dim strSql As String
strSql = "SELECT * FROM test"
objConn = New SqlConnection(ConfigurationManager.AppSettings("scon"))
Dim sdaCust As New SqlDataAdapter(strSql, objConn)
Dim dstCust As New DataSet()
sdaCust.Fill(dstCust, "test")
dstCust.WriteXml(Server.MapPath(pth))
我用上面的方法生成xml文件
?xml version="1.0" encoding="GB2312"?>
<NewDataSet>
<test>
<id>3</id>
<usern>koko</usern>
<mima>koko</mima>
</test>
<test>
<id>19</id>
<usern>logo</usern>
<mima>logo</mima>
</test>
</NewDataSet>
那么有什么方法在sql转换xml时候<?xml version="1.0" standalone="yes"?>变为
<?xml version="1.0" encoding="GB2312"?>便于通过xsl显示成html
<asp:Repeater id="a" runat="server">
<asp:ItemTemplate>
<test>
<id>19</id>
<usern>logo</usern>
<mima>logo</mima>
</test>
</asp:ItemTemplate>
</asp:Repeater>把你取到的DataTable或者DataSet 绑定到Repeater就可以了。还有后台代码加入:Response.ContentType="text/xml",大概意思,具体自己写。