Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is exactly meaning of disconnected and connected approach in ADO.NET

I am learning ADO.Net. I read this line:-

DataReader is "connected" approach and dataset is "disconnected" approach

From this sentence I have reached to this conclusion that in data reader we need to establish the connection to the database while in dataset we do not need to establish the connection to the data base.

But how without establishing the connection one can access data.I know I am not getting the exact meaning.

Please any one can tell me the exact meaning with example.

like image 614
Suri Avatar asked Mar 22 '13 06:03

Suri


People also ask

What is the difference between connected and disconnected mode?

connected data needs connection to be created to access hence slower while disconnected is in memory data that's faster access. to access connected data you use ADO.NET whereas for disconnected you do not use. disconnected-data can be accessed from multiple tables in a dataset. connected- .

What is connected approach?

The connected Approach (Data Reader) is a better choice for applications that require optimized read-only and forward-only access to data such as binding to a Data Grid control. The sooner the data is off-loaded from the Data Reader and the connection is closed the better the application performance.

What is ADO.NET explain disconnected environment?

A disconnected environment is one in which an application is not directly connected to a data source. Data is stored in datasets and manipulations are performed there. After the data has been modified in the dataset, the changes are updated to the database.

Is ADO.NET connected or disconnected architecture?

As mentioned earlier, ADO.NET supports two different programming environments: connected and disconnected. The connected environment provides forward-only, read-only access to data in the data source and the ability to execute commands against the data source.


3 Answers

Disconnected = Make Connection , Fetch Data , Close Connection

Connected = Make Connection , Keep Connection alive , Close Connection when close is called.

For more information , please see the link on MSDN

like image 192
TalentTuner Avatar answered Sep 17 '22 15:09

TalentTuner


The ADO.net architecture, in which connection must be kept open till the end to retrieve and access data from database is called as connected architecture. Connected architecture is built on the these types - connection, command, datareader

The ADO.net architecture, in which connection will be kept open only till the data retrieved from database, and later can be accessed even when connection to database is closed is called as disconnected architecture. Disconnected architecture of ADO.net is built on these types - connection, dataadapter, commandbuilder and dataset and dataview.

like image 43
Deepak Raj Avatar answered Sep 18 '22 15:09

Deepak Raj


Think DataSet as in memory database, it contains DataTables and contain tables data (all or subset of data based on Select query) and even maintain relations among tables. On the DataSet you can perform update/delete operations, it will be synched to database through DataAdapter object. so to display data it does not need to be connected to database All time as DataReader, which needs to be connected to database whenever you want to display data.

like image 38
Adeel Avatar answered Sep 21 '22 15:09

Adeel