Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Recordset to XML and back again. 1

Status
Not open for further replies.

jmarler

Programmer
Jan 29, 2001
679
US
I am looking for a quick an easy way to transform an ADO recordset to an XML string and then how to transform the XML string back into an ADO recordset. I know that the ADO recordset has a save method that would allow me to save the XML definition out to a file as well as the ability to import an XML file into a recordset, but I would like to be able to do this without having to write a file out to the harddrive.
Any thoughts on the matter would be greatly appreciated. Thanks in advance! :)


- Jeff Marler B-)
 
You could persist the recordset into a stream object then use the streams read method to assign a variable.

Good Luck
-Mats Hulten


 
Actually I think that you could persist it directly to the DOM load method as it supports streams, without taking the turn around the Stream object.

-Mats
 
Could you show me what you are talking about? - Jeff Marler B-)
 
Havent actually had the time to try it but... :)

xmlDoc.Load (oRs.save( , adPersistXML))

oRs.save vill try and save to the last used object. I dont know if this will raise an error or if it will work (probobly an error... :), in that case save it to the stream object first (or the respons object if you are using it in ASP)

-Mats
 
Thanks! I'll give it a go and see how it works! - Jeff Marler B-)
 
OK, you were really close, but not quite there. Remember that the save method on an ADO recordset does not return anything. However, if you move things around, you can save it directly to the DOM. Try this . . .

Code:
Call rsData.Save(objXMLDoc, adPersistXML)

Debug.Print objXMLDoc.XML


That will work and it is kind of cool (I will probably use it in the future), but for what I am doing (sending data from MTS to IIS through a firewall) I am going to just use the stream object. That seemed to work perfect. Thanks for the help!
- Jeff Marler B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top