What is exactly meaning of disconnected and connec

2020-06-04 04:53发布

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.

6条回答
Deceive 欺骗
2楼-- · 2020-06-04 05:07

In classic ADO the RecordSet object could work both in connected and disconnected mode. In Ado.Net there are two separate types available to cater to each of these scenarios - IDataReader and DataSet

Connected Mode: remains connected to the underlying data source while traversing in a forward-only streams of result sets.

Disconnected Mode: the resultset retrieved is kept in memory and the connection to the DB is no longer needed for traversal.

This MSDN article further compares the two objects and discusses their individual merits a lot better than I will be able to explain here.

查看更多
The star\"
3楼-- · 2020-06-04 05:27

Connected Architecture : For Every request , Hit the Database , Fetch the DATA and bring Back. you can perform only Read Operation.Connection should be always OPEN.Uses Data Reader

Dis Connected Architecture : Fetch the Entire Data at once and now perform whatever operation you want to perform. Isert / Update / Delete. No need for the connection to be always OPEN.Uses Data Set , Data Adapter

查看更多
▲ chillily
4楼-- · 2020-06-04 05:27

Connected architecture: In connected model we can connect any application to database and stays connected to the database system even when it is not using any database operations. For this architecture, we use Connection, Command and DataReader.

Disconnected architecture: In disconnected model we connect any application to database until we call the close method. In this architecture we use DataSet and DataAdapter.

查看更多
孤傲高冷的网名
5楼-- · 2020-06-04 05:30

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.

查看更多
你好瞎i
6楼-- · 2020-06-04 05:31

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

查看更多
一纸荒年 Trace。
7楼-- · 2020-06-04 05:32

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.

查看更多
登录 后发表回答