熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> SQL Server >> 正文

怎樣用SQL 2000 生成XML

2022-06-13   來源: SQL Server 

  Command 對象有兩個屬性叫Input Stream和Output Stream屬性的值是一個IUnknown接口可以把一個XML Parser的接口賦給它或者是直接用RequestResponse等這樣的好處是不需要再去生成一個Recordset不需要去保存這些數據從而節省了系統開銷
  
  下面給大家一個簡單的把XML用Response返回的Example:
  
  〈%@ Language=VBScript %>
  〈! #include file=ADOVBSinc >
  〈%
  Dim objConn objCmd i
  Set objConn = Servercreateobject(ADODBCONNECTION)
  objConnOpen Provider=SQLOLEDB;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=PBA;Data Source=(local)
  Set objCmd = ServerCreateObject(ADODBCommand)
  objCmdActiveConnection = objConn
  objCmdProperties(Output Stream) = Response
  objCmdProperties(XML Root) = root
  objCmdCommandText = Select * from UserStatus for XML Auto
  ResponseContentType = text/xml
  objCmdExecute i adExecuteStream
  Set objCmd = Nothing
  objConnClose
  Set objConn = Nothing
  %>
From:http://tw.wingwit.com/Article/program/SQLServer/201311/21962.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.