ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 在SQL2000查询中使用XDR的例子(转)

在SQL2000查询中使用XDR的例子(转)

原创 Linux操作系统 作者:jcszjswkzhou 时间:2019-03-21 14:33:07 0 删除 编辑
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:INETPUBWWWROOTPBA"
adoCmd.Properties("Output Stream") = Response

Response.write ""
adoCmd.Execute , , 1024 'adExecuteStream
Response.write "
"
%>

Result:













Orders.xml

xmlns:sql="urn:schemas-microsoft-com:xml-sql">













relation="Orders" />



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-124808/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-08-29

  • 博文量
    1427
  • 访问量
    978777