Therese Lewis
January 31st, 2000, 04:19 PM
Hi All,
I am trying to retrieve an ADO recordset and convert it to an XML stream using ADO 2.5 in a C++ component. Then, I want to return the XML version of the recordset to the component's clients.
I have found working samples in VB that accomplish this. Here is the sample code:
Dim rs as new Recordset
Dim rs2 as new Recordset
Dim c as new Connection
Dim s as new Stream
‘ Query the Titles table.
c.Open “provider=sqloledb;data source=mydb;initial catalog=pubs;user id=sa;password=“
rs.cursorlocation = adUseClient
rs.Open “select * from titles”, c, adOpenStatic
‘ Save to the file in the XML format. Note that if you don’t specify
‘ adPersistXML, a binary format (ADTG) will be used by default.
rs.Save “titles.sav”, adPersistXML
‘ Save the Recordset into the ADO Stream object.
rs.save s, adPersistXML
rs.Close
c.Close
I have also successfully saved a recordset in xml format to a file using VC++.
Any ideas on how to save the XML to a stream and pass stream text back to client in C++?
Any comments or suggestions are appreciated,
Therese
I am trying to retrieve an ADO recordset and convert it to an XML stream using ADO 2.5 in a C++ component. Then, I want to return the XML version of the recordset to the component's clients.
I have found working samples in VB that accomplish this. Here is the sample code:
Dim rs as new Recordset
Dim rs2 as new Recordset
Dim c as new Connection
Dim s as new Stream
‘ Query the Titles table.
c.Open “provider=sqloledb;data source=mydb;initial catalog=pubs;user id=sa;password=“
rs.cursorlocation = adUseClient
rs.Open “select * from titles”, c, adOpenStatic
‘ Save to the file in the XML format. Note that if you don’t specify
‘ adPersistXML, a binary format (ADTG) will be used by default.
rs.Save “titles.sav”, adPersistXML
‘ Save the Recordset into the ADO Stream object.
rs.save s, adPersistXML
rs.Close
c.Close
I have also successfully saved a recordset in xml format to a file using VC++.
Any ideas on how to save the XML to a stream and pass stream text back to client in C++?
Any comments or suggestions are appreciated,
Therese