DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> XML學習教程 >> XML詳解 >> 沒有SQl2000或者Oracle 8i怎麼生成XML?
沒有SQl2000或者Oracle 8i怎麼生成XML?
編輯:XML詳解     
當然你可以自己把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

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved