hi all...
i'm using the command below to get a recodset from a sql2000 in a xml
structure.
select * from tb_perguntas FOR XML RAW
i know that with this command i can get a result like this:.
<Customers CustomerID="ALFKI" CompanyName="Alfreds Futterkiste">
<Orders OrderID="10643" OrderDate="08/25/1997" />
<Orders OrderID="11011" OrderDate="04/09/1998" />
</Customers>
i'm having problems getting this xml string from a ASP page.
i tried:
<%
Dim connObj
Set connObj = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
connObj.ConnectionString = "DRIVER={SQL
Server};SERVER=y;UID=x;PWD=z;DATABASE=h"
connObj.Open
Set rs = connObj.Execute("select * from tb_perguntas FOR XML RAW")
response.write( "rs:" & rs.fields(0).value)
%>
the only thing i want it's display the complete string SQL returned.
please help.
thanks.
please help.You need to use the ICommandStream interface and not the recordset to get
your XML back. See the documentation for examples.
Also, FOR XML raw gives you no hierarchy in the XML, use the AUTO mode or
EXPLICIT mode instead in 2000 (and the PATH mode in 2005).
Best regards
Michael
"rodrigo" <emaildorodrigo@.yahoo.com> wrote in message
news:%23XeLzaYWGHA.3328@.TK2MSFTNGP02.phx.gbl...
> hi all...
> i'm using the command below to get a recodset from a sql2000 in a xml
> structure.
> select * from tb_perguntas FOR XML RAW
> i know that with this command i can get a result like this:.
> <Customers CustomerID="ALFKI" CompanyName="Alfreds Futterkiste">
> <Orders OrderID="10643" OrderDate="08/25/1997" />
> <Orders OrderID="11011" OrderDate="04/09/1998" />
> </Customers>
> i'm having problems getting this xml string from a ASP page.
> i tried:
> <%
> Dim connObj
> Set connObj = Server.CreateObject("ADODB.Connection")
> Set rs = Server.CreateObject("ADODB.Recordset")
> connObj.ConnectionString = "DRIVER={SQL
> Server};SERVER=y;UID=x;PWD=z;DATABASE=h"
> connObj.Open
> Set rs = connObj.Execute("select * from tb_perguntas FOR XML RAW")
> response.write( "rs:" & rs.fields(0).value)
> %>
> the only thing i want it's display the complete string SQL returned.
> please help.
> thanks.
> please help.
>|||hi michael, thanks for the reply.
i looked here:
http://support.microsoft.com/kb/272185/EN-US/
[url]http://www.com.it-berater.org/data_access/oledb/interfaces/ICommandStream.htm[/url
]
and there is no example on how to implement this xml return in asp. the
sample is for win32 console applications.
i can return the normal (not xml) search and then manually get the fields
and values form the recordset and set up the nodes adding the "<" "/>" tags,
however if i can already ge the return in xml why bother creating the tags.
i just can't addimit that nobody have done this before..or maybe it's not
htat simple as i think...
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> escreveu na mensagem
news:ew3DUPcWGHA.3492@.TK2MSFTNGP05.phx.gbl...
> You need to use the ICommandStream interface and not the recordset to get
> your XML back. See the documentation for examples.
> Also, FOR XML raw gives you no hierarchy in the XML, use the AUTO mode or
> EXPLICIT mode instead in 2000 (and the PATH mode in 2005).
> Best regards
> Michael
> "rodrigo" <emaildorodrigo@.yahoo.com> wrote in message
> news:%23XeLzaYWGHA.3328@.TK2MSFTNGP02.phx.gbl...
>|||Did you take a look at
http://msdn.microsoft.com/library/d...>
DOandXML.asp
?
Best regards
Michael
PS: You may need to adjust the provider string...
"rodrigo" <emaildorodrigo@.yahoo.com> wrote in message
news:%23SedSHpWGHA.5012@.TK2MSFTNGP05.phx.gbl...
> hi michael, thanks for the reply.
> i looked here:
> http://support.microsoft.com/kb/272185/EN-US/
> [url]http://www.com.it-berater.org/data_access/oledb/interfaces/ICommandStream.htm[/u
rl]
> and there is no example on how to implement this xml return in asp. the
> sample is for win32 console applications.
> i can return the normal (not xml) search and then manually get the fields
> and values form the recordset and set up the nodes adding the "<" "/>"
> tags,
> however if i can already ge the return in xml why bother creating the
> tags.
> i just can't addimit that nobody have done this before..or maybe it's not
> htat simple as i think...
>
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> escreveu na mensagem
> news:ew3DUPcWGHA.3492@.TK2MSFTNGP05.phx.gbl...
>
No comments:
Post a Comment