首先通过ado。net将数据放在dataset中,然后调用dataset的writexml方法就行了
解决方案 »
- 怎样把存储过程返回的数据集插入到临时表中
- 怎么把这条查询语句简化,高手请指教
- 如何取时间的"日"和"小时"
- 菜鸟求教
- 用Update更新一个超长的文本字段时出现"xxx标识符 太长。最大长度为 128"的错误,何解???????????
- 关于delete from dd where A1 not in (994353,994298,991234,991032,...);
- 如何将数据从一个表复制到另一表??????????????
- 工资该用vb+access还是vfp+sql
- 请教 救命啊
- exchange server 是干什么的?和sql2000有关系吗?
- 这个查询简单吗?征集最佳方案......
- 关于求库存的问题,不知大家采用那一种方法!
SELECT au_fname, au_lname FROM pubs..authors for xml auto
SELECT au_fname, au_lname FROM pubs..authors for xml auto,elements
...买本书看吧,内容太多了
谢谢各位大侠的指导。小妹去虚心学习了。
有问题还请大家多多指点。再多问一句。有没有已经成功的先例呀。
2.IN SQL SERVER2K YOU CAN SEE sp_xml_preparedocument/sp_xml_removedocument.
3.SQLXML3.0 HAVE A LOT OF EXAMPLE.
FOR EXAMPLE:
Option Explicit
Sub main()
Dim oTestStream As New ADODB.Stream
Dim oTestConnection As New ADODB.Connection
Dim oTestCommand As New ADODB.Command
oTestConnection.Open "provider=SQLXMLOLEDB.3.0;data provider=SQLOLEDB;data source=(local);initial catalog=Northwind;user id=UserName;password=UserPassword;"
oTestCommand.ActiveConnection = oTestConnection
oTestCommand.Properties("ClientSideXML") = "True"
oTestCommand.CommandText = _
"<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql' >" & _
" <sql:query> " & _
" SELECT FirstName, LastName FROM Employees FOR XML AUTO " & _
" </sql:query> " & _
" </ROOT> "
oTestStream.Open
' You need the dialect if you are executing a template.
oTestCommand.Dialect = "{5d531cb2-e6ed-11d2-b252-00c04f681b71}"
oTestCommand.Properties("Output Stream").Value = oTestStream
oTestCommand.Properties("Base Path").Value = "c:\Schemas\SQLXMLWR2\New Folder\ExecuteTemplateWithXSL\"
oTestCommand.Properties("xsl").Value = "myxsl.xsl"
oTestCommand.Execute , , adExecuteStreamoTestStream.Position = 0
oTestStream.Charset = "utf-8"
Debug.Print oTestStream.ReadText(adReadAll)
End Sub
Sub Form_Load()
main
End SubThe XSL template follows. The result of applying this XSL template is a two-column table.<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match = 'Employees'>
<TR>
<TD><xsl:value-of select = '@FirstName' /></TD>
<TD><B><xsl:value-of select = '@LastName' /></B></TD>
</TR>
</xsl:template>
<xsl:template match = '/'>
<HTML>
<HEAD>
<STYLE>th { background-color: #CCCCCC }</STYLE>
</HEAD>
<BODY>
<TABLE border='1' style='width:300;'>
<TR><TH colspan='2'>Employees</TH></TR>
<TR><TH >First name</TH><TH>Last name</TH></TR>
<xsl:apply-templates select = 'ROOT' />
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>