How to get XML from ADO

P

Patrick Jackman

Is it possible to get the contents of an ADO recordset returned as XML
without first persisting it to file?

I would like to pass the contents of a temporary table in Access to a SQL
Server stored procedure string parameter via XML.

Patrick
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Patrick Jackman
Vancouver, BC
604-874-5774
 
D

Douglas J. Steele

From the ADO help file:

Dim xDOM As New MSXML.DOMDocument
Dim rsXML As New ADODB.Recordset
Dim sSQL As String, sConn As String

sSQL = "SELECT customerid, companyname, contactname FROM customers"
sConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files" & _
"\Common Files\System\msadc\samples\NWind.mdb"
rsXML.Open sSQL, sConn
rsXML.Save xDOM, adPersistADO 'Save Recordset directly into a DOM tree.
 
P

Patrick Jackman

Thanks Doug.

I also found this on the MS website:

Dim oStream As ADODB.Stream
Set oStream = New ADODB.Stream

oRecordset.Save oStream, adPersistXML

Dim sXML As String
sXML = oStream.ReadText

oStream.Close
Set oStream = Nothing

Patrick.

From the ADO help file:

Dim xDOM As New MSXML.DOMDocument
Dim rsXML As New ADODB.Recordset
Dim sSQL As String, sConn As String

sSQL = "SELECT customerid, companyname, contactname FROM customers"
sConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files" & _
"\Common Files\System\msadc\samples\NWind.mdb"
rsXML.Open sSQL, sConn
rsXML.Save xDOM, adPersistADO 'Save Recordset directly into a DOM tree.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top