·您的位置: 首页 » 资源教程 » 编程开发 » HTML、CSS » 没有SQl2000或者Oracle 8i怎么生成XML?

没有SQl2000或者Oracle 8i怎么生成XML?

类别: XML教程  评论数:0 总得分:0

    当然你可以自己把Recordset编码为XML,不过挺麻烦的,效率也不高。这里介绍一种新的方法:
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 [Employee]", 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 [Employee]", objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
objRS.Save Response, adPersistXML
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing

-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1