get新技能是需要付出行动的,即使看得再多也还是要动手试一试。今天图老师小编跟大家分享的是没有SQl2000或者Oracle 8i怎么生成XML?,一起来学习了解下吧!
【 tulaoshi.com - Web开发 】
当然你可以自己把Recordset编码为XML,不过挺麻烦的,效率也不高。这里介绍一种新的方法:
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)VB Code:
Dim objConn As New ADODB.Connection
Dim objRS As New ADODB.Recordset
Dim objStream As New ADODB.Stream
objConn.Open "Provider=SQLOLEDB.1;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=pubs;Data Source=(local)"
objRS.Open "select * from ", objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
objRS.Save objStream, adPersistXML
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
objStream.Position = 0
Debug.Print objStream.ReadText
objStream.Close
Set objStream = Nothing
-------------------
ASP Code:
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open "Provider=SQLOLEDB.1;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=pubs;Data Source=(local)"
objRS.Open "select * from ", objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
objRS.Save Response, adPersistXML
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
来源:http://www.tulaoshi.com/n/20160219/1618237.html
看过《没有SQl2000或者Oracle 8i怎么生成XML?》的人还看了以下文章 更多>>