Difference between DataReader, DataSet and DataAdapter?
DataReader:
- Connection Oriented architecture.
- DataReader is used to read data from database and it is a read and forward only connection oriented architecture during fetching data from databaset.
- DataReader is used to iterate through result set that came from server and it will read one record at a time, that is why memory consumption will be less and it will fetch the data very fast when compared with DataSet.
- Generally we will use ExecuteReader object to bind data to DataReader.
DataSet:
- Disconnected architecture. This means there is no need of active connections whne we are work with datasets and it is a collection of datatables and relations among tables. It is used to hold multiple tables with data.
- You can select data from tables and views. Also DataSet provides you with rich features like saving data as XML and loading XML data.
DataAdapter:
- Disconnected architecture.
- DataAdapter will acts as a bridge between DataSet and database.
- This DataAdapter object is used to read the data from database and bind that data to dataset.