在 ADO.NET 中检索和修改数据Retrieving and Modifying Data in ADO.NET

任何数据库应用程序的一项主要功能是连接数据源并检索数据源中包含的数据。A primary function of any database application is connecting to a data source and retrieving the data that it contains. ADO.NET 的 .NET Framework 数据提供程序充当应用程序和数据源之间的桥梁,使你能够执行命令以及使用 DataReaderDataAdapter检索数据。The .NET Framework data providers of ADO.NET serve as a bridge between an application and a data source, allowing you to execute commands as well as to retrieve data by using a DataReader or a DataAdapter. 任何数据库应用程序的一项关键功能是更新数据库中存储的数据的能力。A key function of any database application is the ability to update the data that is stored in the database. 在 ADO.NET 中,更新数据涉及使用 DataAdapter 和和 DataSet Command 对象; 它还可能涉及使用事务。In ADO.NET, updating data involves using the DataAdapter and DataSet, and Command objects; and it may also involve using transactions.

本节内容In This Section

连接数据源Connecting to a Data Source
说明如何建立到数据源的连接及如何使用连接事件。Describes how to establish a connection to a data source and how to work with connection events.

连接字符串Connection Strings
包含说明使用连接字符串(包括连接字符串关键字、安全信息以及存储和检索连接字符串)的各个方面的主题。Contains topics describing various aspects of using connection strings, including connection string keywords, security info, and storing and retrieving them.

连接池Connection Pooling
描述 .NET Framework 数据提供程序的连接池。Describes connection pooling for the .NET Framework data providers.

命令和参数Commands and Parameters
包含说明如何创建命令和命令生成器、配置参数以及如何执行命令来检索和修改数据的主题。Contains topics describing how to create commands and command builders, configure parameters, and how to execute commands to retrieve and modify data.

DataAdapter 和 DataReaderDataAdapters and DataReaders
包含说明 DataReader、DataAdapter、参数、处理 DataAdapter 事件和执行批操作的主题。Contains topics describing DataReaders, DataAdapters, parameters, handling DataAdapter events and performing batch operations.

事务和并发性Transactions and Concurrency
包含说明如何执行本地事务、分布式事务及使用开放式并发的主题。Contains topics describing how to perform local transactions, distributed transactions, and work with optimistic concurrency.

检索标识或自动编号值Retrieving Identity or Autonumber Values
提供一个示例,该示例将为 SQL Server 表中的 标识 列或 Microsoft Access 表中的 Autonumber 字段生成的值映射到表中插入行的列。Provides an example of mapping the values generated for an identity column in a SQL Server table or for an Autonumber field in a Microsoft Access table, to a column of an inserted row in a table. 讨论在 DataTable 中合并标识值。Discusses merging identity values in a DataTable.

检索二进制数据Retrieving Binary Data
介绍如何使用检索二进制数据或大数据结构 CommandBehaviorSequentialAccessDescribes how to retrieve binary data or large data structures using CommandBehavior.SequentialAccess 修改的默认行为 DataReaderto modify the default behavior of a DataReader.

使用存储过程修改数据Modifying Data with Stored Procedures
说明如何使用存储过程的输入参数和输出参数在数据库中插入行,同时返回新标识值。Describes how to use stored procedure input parameters and output parameters to insert a row in a database, returning a new identity value.

检索数据库架构信息Retrieving Database Schema Information
说明如何获取可用数据库或编录、数据库中的表和视图、表存在的约束以及数据源中的其他架构信息。Describes how to obtain available databases or catalogs, tables and views in a database, constraints that exist for tables, and other schema information from a data source.

DbProviderFactoriesDbProviderFactories
描述提供程序工厂模型及说明如何在 System.Data.Common 命名空间中使用基类。Describes the provider factory model and demonstrates how to use the base classes in the System.Data.Common namespace.

ADO.NET 中的数据跟踪Data Tracing in ADO.NET
说明 ADO.NET 如何提供内置的数据跟踪功能。Describes how ADO.NET provides built-in data tracing functionality.

性能计数器Performance Counters
说明 SqlClientOracleClient 可用的性能计数器。Describes performance counters available for SqlClient and OracleClient.

异步编程Asynchronous Programming
介绍异步编程的 ADO.NET 支持。Describes ADO.NET support for asynchronous programming.

SqlClient 流支持SqlClient Streaming Support
讨论如何编写从 SQL Server 流式传输数据的应用程序,而无需将其完全加载到内存中。Discusses how to write applications that stream data from SQL Server without having it fully loaded in memory.

请参阅See also