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 物件中以便利用臨機操作 (Ad Hoc) 的方式公開給使用者、與多個來源的資料結合,或在各層之間進行傳遞。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 類別 (Class) 位於 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 可為撰寫 Managed 程式碼的開發人員提供類似於 ActiveX Data Objects (ADO) 提供給原生元件物件模型 (Component Object Model,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). 我們建議您使用 ADO.NET (而非 ADO) 來存取 .NET 應用程式中的資料。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 Entity FrameworkFor 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 中實作 Language-Integrated Query (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