在SQL2000查询中使用XDR的例子
2007-11-11 05:39:48 来源:WEB开发网核心提示:XDR不会不知道吧?就是简化的xml(标准化越来越近了)-Data啦。现在示范一个如何实现这样的查询SELECT o.OrderID, o.OrderDate from Orders o, Customers c,WHERE o.CustomerID = c.CustomerID and c.CompanyName =
XDR不会不知道吧?就是简化的xml(标准化越来越近了)-Data啦。现在示范一个如何实现这样的查询
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:\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 xml(标准化越来越近了)ns="urn:schemas-microsoft-com:xml(标准化越来越近了)-data" xml(标准化越来越近了)ns:dt="urn:schemas-microsoft-com:datatypes"
xml(标准化越来越近了)ns: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>
- ››SQL Server 2008 R2 下如何清理数据库日志文件
- ››sqlite 存取中文的解决方法
- ››SQL2005、2008、2000 清空删除日志
- ››SQL Server 2005和SQL Server 2000数据的相互导入...
- ››sql server 2008 在安装了活动目录以后无法启动服...
- ››使用word强大的搜索和替换功能
- ››sqlserver 每30分自动生成一次
- ››sqlite 数据库 对 BOOL型 数据的插入处理正确用法...
- ››使用Win7自带屏幕录制功能的方法
- ››sql server自动生成批量执行SQL脚本的批处理
- ››使用linux中的quota教程
- ››sql server 2008亿万数据性能优化
赞助商链接