Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a DataSet and a DataTable in .NET?

What is the difference between a DataSet and a DataTable in .NET?

like image 967
paramasivam Avatar asked Feb 21 '11 07:02

paramasivam


People also ask

What is the difference between DataTable and DataSet?

DataSet comprises one or many dataset tables which have the in-memory feature. DataTable holds a single or unit database table that has an in-memory feature. DataSet is formed collectively of datatables. DataTable is composed of multiple rows and columns to have better access to data.

What is difference between DataSet and DataTable in asp net?

A DataTable is an in-memory representation of a single database table. You can think of it as having columns and rows in the same way. A dataset is an in-memory representation of a database-like structure. It can have one or more DataTables and define relations between them, key or any fields etc.

What is the difference between DataSet and data?

Data are observations or measurements (unprocessed or processed) represented as text, numbers, or multimedia. A dataset is a structured collection of data generally associated with a unique body of work.

What is the difference between DataView DataTable and DataSet?

DataTable means single table representation whereas a DataSet is a multiple table representation. That means by using DataTable we can hold only one single table from the database, if we use DataSet we can hold multiple tables at a time... DataView means view of data available in DataSet ...


1 Answers

Basically a DataSet is a collection of DataTables, possibly including relationships between the tables.

From the documentation for DataSet:

The DataSet, which is an in-memory cache of data retrieved from a data source, is a major component of the ADO.NET architecture. The DataSet consists of a collection of DataTable objects that you can relate to each other with DataRelation objects. You can also enforce data integrity in the DataSet by using the UniqueConstraint and ForeignKeyConstraint objects. For further details about working with DataSet objects, see DataSets, DataTables, and DataViews (ADO.NET).

So a DataSet itself doesn't contain the data - that's always within DataTables. The DataSet adds metadata, basically.

like image 125
Jon Skeet Avatar answered Sep 30 '22 14:09

Jon Skeet