6 replies
by kylebanashek
The way that I've used this is to receive this data through a ADO Stream object. When you call the stored procedure (say, from VB or ASP), set the return as a stream object. The stream object has a ReadText method that will allow you to take the returned stream and put it into a String variable. This, however, requires that you use MDAC 2.6+.
Dim s As String
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim strm As ADODB.Stream
Set conn = New ADODB.Connection
Set cmd = New ADODB.Command
conn.ConnectionString = "some connection string"
conn.Open
Set cmd.ActiveConnection = conn
cmd.CommandText = "SELECT * FROM Table FOR XML AUTO, ELEMENTS"
Set strm = cmd.Execute()
s = strm.ReadText(-1)
...
I just did this off the top of my head, so I hope it's all right.
by tonylan
by nlcapit
by jamie
I enjoyed this article and have had fun researching how to actually use the XML. This is what I found for posting the XML to a web page.
<%
Dim conn, cmd
Set conn = createobject("ADODB.Connection")
Set cmd = createobject("ADODB.Command")
conn.ConnectionString = strConn
conn.Open
Set cmd.ActiveConnection = conn
cmd.CommandText = "select aid,catid,status,title from tpdcarticle FOR XML AUTO, ELEMENTS"
cmd.Properties("Output Stream") = response
response.write ""
cmd.execute ,,adExecuteStream
response.write ""
%>
References
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adosql/adoprg03_6coj.asp
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending