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.1;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
%>
【责编:admin】
--------------------next---------------------
阅读(119) | 评论(0) | 转发(0) |