在Microsoft Office中使用ADO.NET 2
点击次数:18 次 发布日期:2008-11-26 10:41:45 作者:源代码网
|
源代码网推荐 源代码网推荐 同样,当 RunQuery 函数被调用时,ADO.NET 会连接到罗斯文 Microsoft SQL Server? 数据库,并将查询结果检索至 DataSet 对象。此时,函数即可返回数据集。.NET 能够序列化数据集,并且 XML 流会被发送回调用者。已序列化的数据集类似于如下所示: 源代码网推荐 源代码网推荐 <?xml version="1.0" encoding="utf-8"?> 源代码网推荐 <DataSet xmlns="http://tempuri.org/WS_XML"> 源代码网推荐 <xs:schema id="NewDataSet" xmlns="" 源代码网推荐 xmlns:xs="http://www.w3.org/2001/XMLSchema" 源代码网推荐 xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> 源代码网推荐 <xs:element name="NewDataSet" msdata:IsDataSet="true"> 源代码网推荐 <xs:complexType> 源代码网推荐 <xs:choice maxOccurs="unbounded"> 源代码网推荐 <xs:element name="Table"> 源代码网推荐 <xs:complexType> 源代码网推荐 <xs:sequence> 源代码网推荐 <xs:element name="OrderID" type="xs:int" minOccurs="0" /> 源代码网推荐 <xs:element name="CustomerID" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 <xs:element name="EmployeeID" 源代码网推荐 type="xs:int" minOccurs="0" /> 源代码网推荐 <xs:element name="OrderDate" 源代码网推荐 type="xs:dateTime" minOccurs="0" /> 源代码网推荐 <xs:element name="RequiredDate" 源代码网推荐 type="xs:dateTime" minOccurs="0" /> 源代码网推荐 <xs:element name="ShippedDate" 源代码网推荐 type="xs:dateTime" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipVia" type="xs:int" minOccurs="0" /> 源代码网推荐 <xs:element name="Freight" 源代码网推荐 type="xs:decimal" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipName" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipAddress" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipCity" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipRegion" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipPostalCode" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 <xs:element name="ShipCountry" 源代码网推荐 type="xs:string" minOccurs="0" /> 源代码网推荐 </xs:sequence> 源代码网推荐 </xs:complexType> 源代码网推荐 </xs:element> 源代码网推荐 </xs:choice> 源代码网推荐 </xs:complexType> 源代码网推荐 </xs:element> 源代码网推荐 </xs:schema> 源代码网推荐 <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 源代码网推荐 xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> 源代码网推荐 <NewDataSet xmlns=""> 源代码网推荐 <Table diffgr:id="Table1" msdata:rowOrder="0"> 源代码网推荐 <OrderID>10248</OrderID> 源代码网推荐 <CustomerID>VINET</CustomerID> 源代码网推荐 <EmployeeID>5</EmployeeID> 源代码网推荐 <OrderDate>1996-07-04T00:00:00.0000000-05:00</OrderDate> 源代码网推荐 <RequiredDate>1996-08-01T00:00:00.0000000- 源代码网推荐 05:00</RequiredDate> 源代码网推荐 <ShippedDate>1996-07-16T00:00:00.0000000- 源代码网推荐 05:00</ShippedDate> 源代码网推荐 <ShipVia>3</ShipVia> 源代码网推荐 <Freight>32.38</Freight> 源代码网推荐 <ShipName>Vins et alcools Chevalier</ShipName> 源代码网推荐 <ShipAddress>59 rue de l"Abbaye</ShipAddress> 源代码网推荐 <ShipCity>Reims</ShipCity> 源代码网推荐 <ShipPostalCode>51100</ShipPostalCode> 源代码网推荐 <ShipCountry>France</ShipCountry> 源代码网推荐 </Table> 源代码网推荐 <Table diffgr:id="Table2" msdata:rowOrder="1"> 源代码网推荐 <OrderID>10249</OrderID> 源代码网推荐 <CustomerID>TOMSP</CustomerID> 源代码网推荐 <EmployeeID>6</EmployeeID> 源代码网推荐 <OrderDate>1996-07-05T00:00:00.0000000-05:00</OrderDate> 源代码网推荐 <RequiredDate>1996-08-16T00:00:00.0000000- 源代码网推荐 05:00</RequiredDate> 源代码网推荐 <ShippedDate>1996-07-10T00:00:00.0000000- 源代码网推荐 05:00</ShippedDate> 源代码网推荐 <ShipVia>1</ShipVia> 源代码网推荐 <Freight>11.61</Freight> 源代码网推荐 <ShipName>Toms Spezialit?ten</ShipName> 源代码网推荐 <ShipAddress>Luisenstr. 48</ShipAddress> 源代码网推荐 <ShipCity>Münster</ShipCity> 源代码网推荐 <ShipPostalCode>44087</ShipPostalCode> 源代码网推荐 <ShipCountry>Germany</ShipCountry> 源代码网推荐 </Table> 源代码网推荐 </NewDataSet> 源代码网推荐 </diffgr:diffgram> 源代码网推荐 </DataSet> 源代码网推荐 源代码网推荐 该 XML 序列化数据集包括两个主要部分: 源代码网推荐 源代码网推荐 XML 架构(常缩写为 XSD)部分,其中包含有关 XML 文档中数据的结构信息。 源代码网推荐 第二部分实际上包含来自查询的数据。正如您所看到的,本文档中讲述的 XML 序列化数据集是来自我们的 SQL Server 数据库的自包含、可移植的数据表示形式。它包括表格结构、数据类型和元素中的数据。 源代码网推荐 该信息对 Microsoft Office 用户有用吗?当然有用。Microsoft Office 完全是为了使数据和信息有用、相关并可操作。随着 XML Web Service 在 Internet 和企业内部网络上的不断扩展,Microsoft Office 用户会希望利用 XML Web Service 所提供的信息。我对 Microsoft Office 用户真正钦佩的原因之一便是他们能够在获得原始数据后对其进行研究、压缩、改变,或采取他们所需的任何方式对其进行处理,以运用这些数据来完成自己的工作。Microsoft Office 为用户提供了对数据进行此类处理时所需的工具,而且最重要的是,我不用再编写更多的代码来解决问题了,因为这些工具可以更好地解决他们。 源代码网推荐 源代码网推荐 其实,真正的原因是我想偷懒。我想用友好的 Microsoft Office 方式为用户提供数据,然后让用户自己处理这些数据。 源代码网推荐 源代码网推荐 了解该信息后,是否就可以在 Microsoft Office 的桌面上根据自己的需要重组这些数据呢?是的。我将在本文的后半部分向您介绍如何利用 Microsoft Excel 的内置方法来使用 XML 序列化数据集,以及如何完全灵活地运用使用 VBA 代码的自定义解决方案通过任一 Office 应用程序做到这一点。 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
