The architecture of ADO.net in which data retrieved from database can be accessed even when connection to database was closed is called as disconnected architecture. Disconnected architecture of ADO.net was built on classes connection, dataadapter, commandbuilder and dataset and dataview.
Connection : Connection object is used to establish a connection to database and connection it self will not transfer any data.
DataAdapter : DataAdapter is used to transfer the data between database and dataset. It has commands
like select, insert, update and delete. Select command is used to
retrieve data from database and insert, update and delete commands are
used to send changes to the data in dataset to database. It needs a
connection to transfer the data.
CommandBuilder : by default dataadapter contains only the select command and it doesn’t contain
insert, update and delete commands. To create insert, update and delete
commands for the dataadapter, commandbuilder is used. It is used only
to create these commands for the dataadapter and has no other purpose.
DataSet : Dataset is used to store the data retrieved from database by dataadapter and make it available for .net application.
To fill data in to dataset fill() method of dataadapter is used and has the following syntax.
Da.Fill(Ds,”TableName”);
When fill method was called, dataadapter will open a connection to
database, executes select command, stores the data retrieved by select
command in to dataset and immediately closes the connection.
As connection to database was closed, any changes to the data in dataset
will not be directly sent to the database and will be made only in the
dataset. To send changes made to data in dataset to the database, Update() method of the dataadapter is used that has the following syntax.
Da.Update(Ds,”Tablename”);
When Update method was called, dataadapter will again open the
connection to database, executes insert, update and delete commands to
send changes in dataset to database and immediately closes the
connection. As connection is opened only when it is required and will be
automatically closed when it was not required, this architecture is
called disconnected architecture.
A dataset can contain data in multiple tables.
DataView : DataView is a view of table available in DataSet. It is used to find a record, sort the records and filter the records. By using dataview, you can also perform insert, update and delete as in case of a DataSet.