Which of the following classes retrieves data from a data source and also resolves changes made to
the DataSet back to the data source?
A.
DataSource
B.
DataTable
C.
DataAdapter
D.
DataReader
Explanation:
A DataAdapter in ADO.NET functions as a bridge between a data source, and a disconnected data
class, such as a DataSet. It is used to specify SQL commands that provide elementary CRUD
functionality. At a more advanced level it offers all the functions required in order to create Strongly
Typed DataSets, including DataRelations.Answer A is incorrect. The DataSource class represents the location and grouping for a
BaseProperty.Answer D is incorrect. DataReader is one of the .NET data providers of ADO.NET. It enables a user to
read data in a sequential manner. A DataReader object retrieves only read-only and forward-only
data and stores only one row of the data in memory at a time. The DataReader object enhances
application performance by retrieving data fast when being requested.
ADO.NET infrastructure provides specific .NET data providers for many DataReader classes. They
include the OLE DB .NET data provider for the OleDbDataReader class and the SQL Server .NET data
provider for the SqlDataReader class.Answer B is incorrect. The DataTable class is used to represent one table of in-memory data. It is a
central object in the ADO.NET library. Other objects, such as DataSet and DataView use the
DataTable class. The DataTable class objects are conditionally case sensitive. If a user is creating a
DataTable class object programmatically, he must first define its schema by adding DataColumn
objects to the DataColumnCollection class. To add rows to a DataTable object, the user must first use
the NewRow method to return a new DataRow object. The DataTable class also includes a collection
of Constraint objects that can be used to ensure the integrity of the data.