Advertisement
Difference between Data Reader and Data Set in Asp.Net | Data Reader vs. Data Set
Difference between Data Reader and Data Set in Asp.Net
Data Reader |
Data Set |
|
---|---|---|
Connection Mode | Data Reader is directly connected to database system i.e works in connected mode. | Data Set is generally used to employ disconnected architecture of ADO.Net. It works in disconnected mode. |
No. of Tables | Data Reader can hold one table at a time. | Data Set can hold multiple tables at a time. It represents a computer set of data including related tables, constraints and relationships among the tables. |
Read Only | Data reader can use multiple user updated data every time. | If multiple users are using the database and database needs to be updated every time, you must not use the data set. |
Data Access | Data Reader provides Read only access to data i.e. we can not update data. | Data Set allows access on data i.e with that you have read and update access. |
Navigation | Data Reader is like a forward only scan of records. | Data Set allows both forward & backward scan of records |
Storage | No Local storage is required | It reads data from database and stores in local system. |
Performance | Data Reader improve application performance. | Data Set is always a bulky object that requires lot of memory space compare to Data Reader. |
Hold Records | It holds one row at a time. | It holds multiple rows at a time. |
Memory | It occupies less memory. | It occupies more memory |
Relationship | It does not maintain relationship. | It maintains the relationship. |
XML Support | No XML storage available.If data does not need to be modified, cached or serialized consider using a reader. | Can be stored as XML. |