Blogger Widgets

Total Page visits

Saturday, March 2, 2013

ADO.NET Differences



What are the differences between DataReader and DataAdapter?

S.No
DataReader
DataAdapter
1
Works in Connected Mode
Works in Disconnected Mode
2
Can have only one record at a time
Can have more than 1 records
3
Is ForwardOnly and Readonly
Can navigate front and back and editable
4
Faster
Slower

What are the differences between DataSet and DataReader?

S.No
DataSet
DataReader
1
The data store whose records have to be manipulated can be disconnected.
You can read data from datareader only if the connection to data store exists.
2
You have the provision to cache data fetched from data store when using dataset.
Caching of data is not possible.
3
Dataset objects have XML Support.
XML Support is not provided by datareader.
4
A single dataset object can contain collection of datatable objects wherein each datatable object refers to a table in the datastore. Hence you can manipulate on multiple tables using a dataset.
Datareader can read records fetched by a command object containing a single query. If you have to fetch data from multiple tables, then datareader is not advantageous when compared to dataset.
5
Using dataset, you can read the records fetched in any order.
While reading records, you can iterate only in forward direction.
6
Performance wise, dataset is slow because it has multiple tables which in turn include multiple rows, columns and constraints.
Datareader gives high performance and records can be fetched faster when compared to dataset.

What is the difference between DataSet.Copy() and DataSet.Clone()?

S.No
DataSet.Copy()
DataSet.Clone()
1
DataSet.Copy() copies both the structure and data
DataSet.Clone() copies the structure of the DataSet, including all DataTable schemas, relations, and constraints and it does not copy any data

What are the differences between RecordSet and DataSet?

S.No
RecordSet
DataSet
1
RecordSet provides data of one row at an instant
DataSet is a data structure which represents the complete table data at the same time
2
RecordSet always needs an Open connection to read the data from data sources
DataSet needs connection only for retrieving the data. After retrieve the data connection is not necessary
3
RecordSet is able to load the structure and data of only one table at a time
DataSet has the capability to store the structure and data of multiple tables at a time
4
RecordSet does not support constraints of Databases
DataSet enforces data integrity by using Constraints


No comments: