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

前端 未结 6 1825
孤城傲影
孤城傲影 2021-02-06 09:31

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

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

From this

相关标签:
6条回答
  • 2021-02-06 09:41

    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.

    0 讨论(0)
  • 2021-02-06 09:46

    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.

    0 讨论(0)
  • 2021-02-06 09:48

    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

    0 讨论(0)
  • 2021-02-06 09:52

    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.

    0 讨论(0)
  • 2021-02-06 10:00

    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.

    0 讨论(0)
  • 2021-02-06 10:06

    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

    0 讨论(0)
提交回复
热议问题