There is difference between DataReader and DataSet Is List Out Here
1>
A DataReader works in a connected environment, where as DataSet works in a disconnected environment.
2>
A DataReader object represents a forward only, read only access to data from a source. It implements
IDataReader & IDataRecord interfaces.
For example, The SQLDataReader class can read rows from tables in a SQL Server data source. It is returned
by the ExecuteReader method of the SQLCommand class, typically as a result of a SQL Select statement.
The DataReader class' HasRows property can be called to determine whether the DataReader retrieved
any rows from the source. This can be used before using the Read method to check whether any data
has been retrieved.
3>
A DataSet represents an in-memory cache of data consisting of any number of inter-related DataTable objects. A
DataTable object represents a tabular block of in-memory data. Further, a DataRow represents a single row
of a DataTable object. A Dataset is like a mini-database engine, but its data is stored in the memory. To query the
data in a DataSet, we can use a DataView object.
DataSet object | DataReader object |
Read/Write access | Read-only access |
Supports multiple tables from different databases | Supports a single table based on a single SQL query of one database |
Disconnected mode | Connected mode |
Bind to multiple controls | Bind to a single control |
Forward and backward scanning of data | Forward-only scanning of data |
Slower access to data | Faster access to data |
Greater overhead to enable additional features | Lightweight object with very little overhead |
Supported by Visual Studio .NET tools | Must be manually coded |
No comments:
Post a Comment