There are four core objects that make up each .NET data provider, that you as a developer should be familiar with.
- Connections - for connecting to and managing operations against a database.
- Commands - for issuing SQL commands to execute against a database.
- DataReaders - for directly reading data off a stream.
- DataSets and DataAdapters - for storing and manipulating data in a memory-resident data store.
In brief, the core ADO.NET functionalities may be summarized as follows.
The Connection object provides connectivity to a data source. It establishes the link between a Web page and a database.
Once a link exists, different forms of Commands can be issued to the database provider. Commands act directly against the database, and in most cases return a result set. Commands can also be issued to run stored procedures, get or set parameter information, and modify data.
For fast, efficient display-only of data, the result set can be read by a DataReader. The DataReader provides a high-performance stream of data from the data source.
To enable users to work with the data, the result set can be stored into a memory-resident DataSet object, which are manipulated via DataAdapter objects. Using the built-in methods in the DataAdapter, changes in the DataSet can easily be reconciled with the underlying data source.
If you do not require the functionality provided by the DataSet, you can improve the performance of your application by using the DataReader to return data in a forward-only, read-only manner.
In later sections, we explore in detail how to implement data access in Web pages using these objects. But first, let us walk through an overview of the alternate approach using data source controls.
NOTE: The material covered in the following sections assume some familiarity with database fundamentals and Structured Query Langauge ( SQL ).
ASP.NET DataSource Controls Overview