' ...my recordset rs ist already filled with the sql-result
' first initialising the Response-object
Response.ContentType = "text/xml"
Response.Expires = 0
Response.Buffer = False
' the xml-header
Response.Write "<?xml version='1.0'?>" & vbNewLine
' and thats the trick: the save method of the recordset
' with Response as Destination
' and adPersistXML as type
rs.Save Response, adPersistXML
' this is wellknown and saves the recordset to a file (as xml)
rs.Save App.Path & "\" & "RS " & Replace(Now, ":", "-") & _
".xml", adPersistXML
greetings,
franc walter
but don't use this ms-xml style for serious purposes in a
XmlHttpRequest(e.g. firefox...) -
DOM may not work.
make it yourself, for example:
Function AdoToXML(ByRef rs As ADODB.Recordset) As String
'rs is the recordset filled with data
Dim l As Long, k As Long
AdoToXML = "<?xml version=""1.0"" encoding=""iso-8859-1""?>" &
vbNewLine
AdoToXML = AdoToXML & "<rs>" & vbNewLine
For l = 0 To rs.RecordCount - 1
AdoToXML = AdoToXML & "<rs" & CStr(l) & ">" & vbNewLine
For k = 0 To rs.Fields.Count - 1
AdoToXML = AdoToXML & "<" & rs.Fields(k).Name & ">" & vbNewLine
AdoToXML = AdoToXML & rs.Fields(k).Value & vbNewLine
AdoToXML = AdoToXML & "</" & rs.Fields(k).Name & ">" & vbNewLine
Next k
AdoToXML = AdoToXML & "</rs" & CStr(l) & ">" & vbNewLine
rs.MoveNext
Next l
AdoToXML = AdoToXML & "</rs>" & vbNewLine
End Function
(no garantee)
franc