Examples of using XDR in SQL2000 queries

Source: Internet
Author: User
XDR doesn't know, does it? is the simplified xml-data. Now demonstrate how to implement such a query
SELECT O.orderid, o.orderdate from Orders O, Customers C,
WHERE O.customerid = C.customerid and C.companyname =?
Code:
<%@ Language=vbscript%>
<%
Dim sconn
sconn = "PROVIDER=SQLOLEDB; Data source= (local); Initial Catalog=northwind; User Id=sa; password=; "

Dim Adoconn
Set adoconn = Server.CreateObject ("ADODB. Connection ")
adoconn.connectionstring = sconn
adoconn.cursorlocation = 3 ' adUseClient
Adoconn.open

Dim Adocmd
Set Adocmd = CreateObject ("Adodb.command")
Set adocmd.activeconnection = Adoconn
Adocmd.commandtext = "customer[@CompanyName =" "Tortuga Restaurante" "]"
Adocmd.dialect = "{ec2a4293-e898-11d2-b1b7-00c04f680c56}"

Adocmd.properties ("Mapping Schema") = "Orders.xml"
Adocmd.properties ("Base Path") = "C:INETPUBWWWROOTPBA"
Adocmd.properties ("Output Stream") = Response

Response.Write "<xml id= ' Mydataisle ' >"
Adocmd.execute, 1024 ' adExecuteStream
Response.Write "</XML>"
%>
Result:
<xml id= "Mydataisle" >
<customer customerid= "Tortu" companyname= "Tortuga Restaurante" >
<order customerid= "Tortu" orderid= "10276" orderdate= "1996-08-08t00:00:00"/>
<order customerid= "Tortu" orderid= "10293" orderdate= "1996-08-29t00:00:00"/>
<order customerid= "Tortu" orderid= "10304" orderdate= "1996-09-12t00:00:00"/>
<order customerid= "Tortu" orderid= "10319" orderdate= "1996-10-02t00:00:00"/>
<order customerid= "Tortu" orderid= "10518" orderdate= "1997-04-25t00:00:00"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.