ADO.NET 概述ADO.NET Overview

ADO.NET 提供对诸如 SQL Server 和 XML 这样的数据源以及通过 OLE DB 和 ODBC 公开的数据源的一致访问。ADO.NET provides consistent access to data sources such as SQL Server and XML, and to data sources exposed through OLE DB and ODBC. 共享数据的使用方应用程序可以使用 ADO.NET 连接到这些数据源,并可以检索、处理和更新其中包含的数据。Data-sharing consumer applications can use ADO.NET to connect to these data sources and retrieve, handle, and update the data that they contain.

ADO.NET 通过数据处理将数据访问分解为多个可以单独使用或一前一后使用的不连续组件。ADO.NET separates data access from data manipulation into discrete components that can be used separately or in tandem. ADO.NET 包含用于连接到数据库、执行命令和检索结果的 .NET Framework 数据提供程序。ADO.NET includes .NET Framework data providers for connecting to a database, executing commands, and retrieving results. 这些结果或者被直接处理,放在 ADO.NET DataSet 对象中以便以特别的方式向用户公开,并与来自多个源的数据组合;或者在层之间传递。Those results are either processed directly, placed in an ADO.NET DataSet object in order to be exposed to the user in an ad hoc manner, combined with data from multiple sources, or passed between tiers. DataSet 对象也可以独立于 .NET Framework 数据提供程序,用于管理应用程序本地的数据或源自 XML 的数据。The DataSet object can also be used independently of a .NET Framework data provider to manage data local to the application or sourced from XML.

ADO.NET 类位于 System.Data.dll 中,并与 System.Xml.dll 中的 XML 类集成。The ADO.NET classes are found in System.Data.dll, and are integrated with the XML classes found in System.Xml.dll. 有关连接到数据库的示例代码,从该代码中检索数据,然后在控制台窗口中显示该数据,请参阅 ADO.NET 代码示例For sample code that connects to a database, retrieves data from it, and then displays that data in a console window, see ADO.NET Code Examples.

ADO.NET 向编写托管代码的开发人员提供类似于 ActiveX 数据对象 (ADO) 向本机组件对象模型 (COM) 开发人员提供的功能。ADO.NET provides functionality to developers who write managed code similar to the functionality provided to native component object model (COM) developers by ActiveX Data Objects (ADO). 建议您在 .NET 应用程序中使用 ADO.NET 而不使用 ADO 来访问数据。We recommend that you use ADO.NET, not ADO, for accessing data in your .NET applications.

ADO.NET 在 .NET Framework 中提供最直接的数据访问方法。ADO.NET provides the most direct method of data access within the .NET Framework. 若要使应用程序能够使用概念模型而不是基础存储模型,请参阅 ADO.NET 实体框架For a higher-level abstraction that allows applications to work against a conceptual model instead of the underlying storage model, see the ADO.NET Entity Framework.

隐私声明: System.Data.dll、System.Data.Design.dll、System.Data.OracleClient.dll、System.Data.SqlXml.dll、System.Data.Linq.dll、System.Data.SqlServerCe.dll 和 System.Data.DataSetExtensions.dll 程序集不区分用户的私有数据和非私有数据。Privacy Statement: The System.Data.dll, System.Data.Design.dll, System.Data.OracleClient.dll, System.Data.SqlXml.dll, System.Data.Linq.dll, System.Data.SqlServerCe.dll, and System.Data.DataSetExtensions.dll assemblies do not distinguish between a user's private data and non-private data. 这些程序集不收集、存储或传输任何用户隐私数据。These assemblies do not collect, store, or transport any user's private data. 不过,第三方应用程序可能会使用这些程序集收集、存储或传输用户的隐私数据。However, third-party applications might collect, store, or transport a user's private data using these assemblies.

本节内容In This Section

ADO.NET 体系结构ADO.NET Architecture
提供 ADO.NET 结构和组件的概述。Provides an overview of the architecture and components of ADO.NET.

ADO.NET 技术选项和准则ADO.NET Technology Options and Guidelines
描述实体数据平台附带的产品和技术。Describes the products and technologies included with the Entity Data Platform.

描述如何在 ADO.NET 中实现语言集成查询 (LINQ) 并提供指向相关主题的链接。Describes how Language-Integrated Query (LINQ) is implemented in ADO.NET and provides links to relevant topics.

.NET Framework 数据提供程序.NET Framework Data Providers
提供有关 .NET Framework 数据提供程序的设计的概述以及有关随 ADO.NET 提供的 .NET Framework 数据提供程序的概述。Provides an overview of the design of the .NET Framework data provider and of the .NET Framework data providers that are included with ADO.NET.

提供有关 DataSet 设计和组件的概述。Provides an overview of the DataSet design and components.

ADO.NET 中的并行执行Side-by-Side Execution in ADO.NET
讨论 ADO.NET 各个版本之间的区别及其对并行执行和应用程序兼容性的影响。Discusses differences in ADO.NET versions and their effect on side-by-side execution and application compatibility.

ADO.NET 代码示例ADO.NET Code Examples
提供使用 ADO.NET 数据提供程序检索数据的代码示例。Provides code samples that retrieve data using the ADO.NET data providers.

ADO.NET 新增功能What's New in ADO.NET
介绍 ADO.NET 中的新增功能。Introduces features that are new in ADO.NET.

保证 ADO.NET 应用程序的安全Securing ADO.NET Applications
描述使用 ADO.NET 时的安全编码做法。Describes secure coding practices when using ADO.NET.

ADO.NET 中的数据类型映射Data Type Mappings in ADO.NET
描述 .NET Framework 数据类型与 .NET Framework 数据提供程序之间的数据类型映射。Describes data type mappings between .NET Framework data types and the .NET Framework data providers.

在 ADO.NET 中检索和修改数据Retrieving and Modifying Data in ADO.NET
说明如何连接到数据源、检索数据和修改数据。Describes how to connect to a data source, retrieve data, and modify data. 这包括 DataReadersDataAdaptersThis includes DataReaders and DataAdapters.

请参阅See also