asp SQL server 2000 读取记录直接生成xml文档

来源:互联网 发布:剑灵捏脸数据图怎么用 编辑:程序博客网 时间:2024/05/01 17:51

<% @Language="VBScript" %>
<%
  Dim objConn, objCmd, i
  Set objConn = Server.createobject("ADODB.CONNECTION")
  objConn.Open "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=ca800;Data Source=

(local)"
  Set objCmd = Server.CreateObject("ADODB.Command")
  objCmd.ActiveConnection = objConn
  objCmd.Properties("Output Stream") = Response
  objCmd.Properties("XML Root") = "root"
  'objCmd.properties("Output Encoding")="GB2312"
  objCmd.CommandText = "Select top 20 * from ca_news for XML Auto,elements"
  Response.ContentType = "text/xml"
  objCmd.Execute i,,1024 'adExecuteStream
  Set objCmd = Nothing
  objConn.Close
  Set objConn = Nothing

%> 

原创粉丝点击