Last post Aug 28, 2008 07:51 AM by jamest85
Aug 27, 2008 10:12 PM|jamest85|LINK
I am trying to understand more about those two concepts.
From the <<asp.net2.0 Unleashed by Stephen Walther>>:
Connected Data Access: when read data from a database by using a sqlDataReader object, an open connection must be maintained between application and the database.
Disconnected Data Access: When use dataAdapter, DataTable, DataSet, DataView objects, you don't need keep a connection to the database open.
I understand one advantage of Disconnected data access is: you can filter and sort the rows represented by a DataView, but I want have more example to convince me why use Connected or Disconnected Data Access.
Would you please give me some examples (some extreme cases) showing why use: disconnected (or connected) data Access?
Thanks a lot.
Aug 28, 2008 06:38 AM|kamii47|LINK
For That u may try to explore Dataset and Datareader difference
DATA ReaderThe DataReader has a defined set of operations that revolvearound its connected, forward-only, read-only nature (theread-only DataReader is also known as the firehose cursor ofADO.NET). A DataReader is a stream of data that is returnedfrom a database query. When the query is executed, the firstrow is returned to the DataReader via the stream. The streamthen remains connected to the database, poised to retrievethe next record. The DataReader reads one row at a time fromthe database and can only move forward, one record at atime. As the DataReader reads the rows from the database,the values of the columns in each row can be read andevaluated, but they cannot be edited.DATA AdapterThe DataSet is the main data storage tool in the ADO.NETdisconnected architecture. Unlike the DataReader, theDataSet is not connected directly to a database through aConnection object when you populate it. Instead, to fill aDataSet from a database you first create a DataAdapterobject (such as a SqlDataAdapter) for the provider andassociate it with a SqlConnection object. Then theSqlDataAdapter can broker the data retrieval for the DataSetby issuing a SqlCommand against the database through theSqlConnection, retrieving the data, and filling the DataSet.You can think of the SqlDataAdapter as a bridge between theconnected and disconnected objects. One of its purposes isto serve as the route for a rowset to get from the databaseto the DataSet. For example, when the SqlDataAdapter's Fillmethod is executed it opens its associated SqlConnectionobject (if not already open) and issues its associatedSqlCommand object against the SqlConnection. Behind thescenes, a SqlDataReader is created implicitly and the rowsetis retrieved one row at a time in succession and sent to theDataSet. Once all of the data is in the DataSet, theimplicit SqlDataReader is destroyed and the SqlConnection isclosed.
There are lots of other good differences are given.
Aug 28, 2008 07:17 AM|vinz|LINK
Give these a read:
http://forums.asp.net/p/1072914/1571338.aspx <--- Find out DMW's answer
Aug 28, 2008 07:51 AM|jamest85|LINK
thank u very much. all good stuff.