Step 3: Send the Data
Step 3: Send the Data
Now that you have a Recordset, you need to send it to the client by saving it as XML to the ASP Response object. Add the following code to the bottom of XMLResponse.asp:
Response.ContentType = "text/xml"
Response.Expires = 0
Response.Buffer = False
Response.Write "<?xml version='1.0'?>" & vbNewLine
adoRec.save Response, adPersistXML
adoRec.Close
Set adoRec=Nothing
%>
Notice that the ASP Response object is specified as the destination for the Recordset Save method. The destination of the Save method can be any object that supports the IStream interface, such as an ADO Stream object, or a file name that includes the complete path to which the Recordset is to be saved.
Save and close XMLResponse.asp before going to the next step. Also copy the adovbs.inc file from the default ADO library installation folder to the same folder where you saved the XMLResponse.asp file.