What is DataSet and DataTable in .NET Framework?


Dataset provides a disconnected representation of result sets from the Data Source. It is completely independent of the Data Source. It provides much greater flexibility when dealing with related result sets.

What is DataSet and DataTable in .NET Framework

The dataset contains rows, columns, primary keys, constraints, and relations with other DataTable objects. It consists of a collection of DataTable objects that you can relate to each other with DataRelation objects.


The DataTable class is located in the .NET Framework at System.Data.DataTable. It represents a table of in-memory data that is contained with a Dataset object. It can be created automatically by returning result sets from the DataAdapter to the Dataset object.


The DataRow class represents a row of data in the DataTable object. The DataRow class and the Data column class represents the primary objects that comprise the DataTable class. The DataRow object is used to insert, update and delete rows from a DataTable.


The DataReader Object is a stream-based forward-only, read-only retrieval of query results from the Data Source, which don’t update the data. DataReader requires a live connection with the database and it provides a very intelligent way of consuming all or part of the result set.