|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
对于update操作,只需要把event中的旧行和新行值对调即可。XDR不会不晓得吧?就是简化的XML-Data啦。如今树模一个怎样完成如许的查询
SELECTo.OrderID,o.OrderDatefromOrderso,Customersc,
WHEREo.CustomerID=c.CustomerIDandc.CompanyName=?
Code:
<%@Language=VBScript%>
<%
DimsConn
sConn="Provider=SQLOLEDB;DataSource=(local);InitialCatalog=Northwind;UserID=SA;Password=;"
DimadoConn
SetadoConn=Server.CreateObject("ADODB.Connection")
adoConn.ConnectionString=sConn
adoConn.CursorLocation=3adUseClient
adoConn.Open
DimadoCmd
SetadoCmd=CreateObject("ADODB.Command")
SetadoCmd.ActiveConnection=adoConn
adoCmd.CommandText="Customer[@CompanyName=""TortugaRestaurante""]"
adoCmd.Dialect="{ec2a4293-e898-11d2-b1b7-00c04f680c56}"
adoCmd.Properties("MappingSchema")="Orders.xml"
adoCmd.Properties("BasePath")="C:INETPUBWWWROOTPBA"
adoCmd.Properties("OutputStream")=Response
Response.write"<XMLID=MyDataIsle>"
adoCmd.Execute,,1024adExecuteStream
Response.write"</XML>"
%>
Result:
<XMLID="MyDataIsle">
<CustomerCustomerID="TORTU"CompanyName="TortugaRestaurante">
<OrderCustomerID="TORTU"OrderID="10276"OrderDate="1996-08-08T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10293"OrderDate="1996-08-29T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10304"OrderDate="1996-09-12T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10319"OrderDate="1996-10-02T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10518"OrderDate="1997-04-25T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10576"OrderDate="1997-06-23T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10676"OrderDate="1997-09-22T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10842"OrderDate="1998-01-20T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="10915"OrderDate="1998-02-27T00:00:00"/>
<OrderCustomerID="TORTU"OrderID="11069"OrderDate="1998-05-04T00:00:00"/>
</Customer>
</XML>
Orders.xml
<?xmlversion="1.0"?>
<Schemaxmlns="urn:schemas-microsoft-com:xml-data"xmlns:dt="urn:schemas-microsoft-com:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<ElementTypename="Order"sql:relation="Orders">
<AttributeTypename="CustomerID"/>
<AttributeTypename="OrderID"/>
<AttributeTypename="OrderDate"/>
<attributetype="CustomerID"sql:field="CustomerID"/>
<attributetype="OrderID"sql:field="OrderID"/>
<attributetype="OrderDate"sql:field="OrderDate"/>
</ElementType>
<ElementTypename="Customer"sql:relation="Customers">
<AttributeTypename="CustomerID"/>
<AttributeTypename="CompanyName"/>
<attributetype="CustomerID"sql:field="CustomerID"/>
<attributetype="CompanyName"sql:field="CompanyName"/>
<elementtype="Order">
<sql:relationshipkey-relation="Customers"key="CustomerID"foreign-key="CustomerID"foreign-
relation="Orders"/>
</element>
</ElementType>
</Schema>
一个语句分成两个event(实际上不止,其他可以忽略),一个table_mapevent和一个Rows_log_event。Table_mapevent是一样的,主要看Rows_log_event。 |
|