Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2008

Tip: Looking for answers? Try searching our database.

How to get XML from ADO

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patrick Jackman - 17 May 2008 17:22 GMT
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
Douglas J. Steele - 18 May 2008 01:39 GMT
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.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Is it possible to get the contents of an ADO recordset returned as XML
> without first persisting it to file?
[quoted text clipped - 7 lines]
> Vancouver, BC
> 604-874-5774
Patrick Jackman - 18 May 2008 22:39 GMT
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.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Is it possible to get the contents of an ADO recordset returned as XML
> without first persisting it to file?
[quoted text clipped - 7 lines]
> Vancouver, BC
> 604-874-5774
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.