Computer Science Department Rapid Application Development: Chapter 4: Database Programming
Computer Science Department Rapid Application Development: Chapter 4: Database Programming
Computer Science Department Rapid Application Development: Chapter 4: Database Programming
a) Data
b) Data service
Microsoft ActiveX Data Objects.Net (ADO.Net) is a model, a part of the .Net framework that is
used by the .Net applications for retrieving, accessing, and updating data.
ADO.Net object model is nothing but the structured process flow through various components. The
object model can be pictorially described as:
The data residing in a data store or database is retrieved through the data provider.
o Datasets store data in a disconnected cache and the application retrieves data from it.
o Data readers provide data to the application in a read-only and forwardonly mode.
Data Provider
A data provider is used for connecting to a database, executing commands and retrieving data, storing
it in a dataset, reading the retrieved data and updating the database.
The .Net Framework data provider for SQL Server - provides access to Microsoft SQL
Server.
The .Net Framework data provider for OLE DB - provides access to data sources exposed
by using OLE DB.
The .Net Framework data provider for ODBC - provides access to data sources exposed by
ODBC.
The .Net Framework data provider for Oracle - provides access to Oracle data source.
The EntityClient provider - enables accessing data through Entity Data Model (EDM)
applications.
DataSet
DataSet is an in-memory representation of data. It is a disconnected, cached set of records that are
retrieved from a database. When a connection is established with the database, the data adapter creates
a dataset and stores data in it. After the data is retrieved and stored in a dataset, the connection with the
database is closed. This is called the 'disconnected architecture'. The dataset works as a virtual database
containing tables, rows, and columns.
The DataSet class is present in the System.Data namespace. The following table describes all the
components of DataSet:
DataTableCollection: It contains all the tables retrieved from the data source.
DataRelationCollection : It contains relationships and the links between tables in a data set.
ExtendedProperties : It contains additional information, like the SQL statement for retrieving data, time
of retrieval, etc.
DataTable: It represents a table in the DataTableCollection of a dataset. It consists of the DataRow and
DataColumn objects. The DataTable objects are casesensitive.
DataView : It represents a fixed customized view of a DataTable for sorting, filtering, searching, editing,
and navigation.
DataRow : It represents a row in the DataTable. The DataRow object and its properties and methods
are used to retrieve, evaluate, insert, delete, and update values in the DataTable. The NewRow method is
used to create a new row and the Add method adds a row to the table.
Connecting to a Database
The .Net Framework provides two types of Connection classes: