objConn.Open "Provider=SQLOLEDB.1;PassWord=;Persist Security Info=True;User ID=sa;Initial Catalog=pubs;Data Source=(local)"
objRS.Open "select * from [Employee]", objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
objRS.Save obJStream, adPersistXML
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
obJStream.Position = 0
Debug.Print obJStream.ReadText
obJStream.Close
Set obJStream = Nothing
-------------------
ASP Code:
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open "Provider=SQLOLEDB.1;PassWord=;Persist Security Info=True;User ID=sa;Initial Catalog=pubs;Data Source=(local)"
objRS.Open "select * from [Employee]", objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
objRS.Save Response, adPersistXML
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing