现在的位置: 首页 > 综合 > 正文

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

2013年08月27日 ⁄ 综合 ⁄ 共 610字 ⁄ 字号 评论关闭

<% @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

%> 

【上篇】
【下篇】

抱歉!评论已关闭.