Command 對象有兩個屬性
叫Input Stream和Output Stream
屬性的值是一個IUnknown接口
可以把一個XML Parser的接口賦給它
或者是直接用Request
Response等
這樣的好處是不需要再去生成一個Recordset
不需要去保存這些數據
從而節省了系統開銷
下面給大家一個簡單的把XML用Response返回的Example:
〈%@ Language=VBScript %>
〈!
#include file=
ADOVBS
inc
>
〈%
Dim objConn
objCmd
i
Set objConn = Server
createobject(
ADODB
CONNECTION
)
objConn
Open
Provider=SQLOLEDB
;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=PBA;Data Source=(local)
Set objCmd = Server
CreateObject(
ADODB
Command
)
objCmd
ActiveConnection = objConn
objCmd
Properties(
Output Stream
) = Response
objCmd
Properties(
XML Root
) =
root
objCmd
CommandText =
Select * from UserStatus for XML Auto
Response
ContentType =
text/xml
objCmd
Execute i
adExecuteStream
Set objCmd = Nothing
objConn
Close
Set objConn = Nothing
%>
From:http://tw.wingwit.com/Article/program/SQLServer/201311/21962.html