注册
 找回密码
 注册
江西广告网
查看: 183|回复: 0
打印 上一主题 下一主题

在SQL 2000查询中使用XDR的一些例子

[复制链接]

该用户从未签到

1
跳转到指定楼层
发表于 2009-1-17 08:32:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册

x
  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=SAassword=;"        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:\INETPUB\WWWROOT\PBA\"        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" />       <Order CustomerID="TORTU" OrderID="10576" OrderDate="1997-06-23T00:00:00" />       <Order CustomerID="TORTU" OrderID="10676" OrderDate="1997-09-22T00:00:00" />       <Order CustomerID="TORTU" OrderID="10842" OrderDate="1998-01-20T00:00:00" />       <Order CustomerID="TORTU" OrderID="10915" OrderDate="1998-02-27T00:00:00" />       <Order CustomerID="TORTU" OrderID="11069" OrderDate="1998-05-04T00:00:00" />      </Customer>      </XML>       Orders.xml      <?xml version="1.0" ?>      <Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes"      xmlns:sql="urn:schemas-microsoft-com:xml-sql">       <ElementType name="Order" sql:relation="Orders">        <AttributeType name="CustomerID" />        <AttributeType name="OrderID" />        <AttributeType name="OrderDate" />        <attribute type="CustomerID" sql:field="CustomerID" />        <attribute type="OrderID" sql:field="OrderID" />        <attribute type="OrderDate" sql:field="OrderDate" />       </ElementType>       <ElementType name="Customer" sql:relation="Customers">        <AttributeType name="CustomerID" />        <AttributeType name="CompanyName" />        <attribute type="CustomerID" sql:field="CustomerID" />        <attribute type="CompanyName" sql:field="CompanyName" />        <element type="Order">         <sql:relationship key-relation="Customers" key="CustomerID" foreign-key="CustomerID" foreign-      relation="Orders" />        </element>       </ElementType>      </Schema> <
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表