0

Possible Duplicate:
Datatable vs Dataset

I want to know the difference in terms of memory, efficiency if I'm using DataSet instead of DataTable to fill data.

I want to explain this to a third party so strong reason needed.

Community
  • 1
  • 1
ketan
  • 1
  • 1
  • If you're retrieving just a single table, then using a `DataSet` is just unnecessary overhead - in terms of memory and performance – marc_s Sep 27 '11 at 05:22

3 Answers3

3

DataSet is an in memory representation of database which contains a collection DataTable and DataRelation object is used to relates these tables. On the other hand, DataTable represents an in memory data cache for any "single" table of database.

So if you are dealing with only single table then its better to use DataTable instead of DataSet

Waqas
  • 6,812
  • 2
  • 33
  • 50
0

DataSet can hold multiple DataTables and datasets maintain some internal indexes to improve performs for things like finds and selects.

Some interesting discussions

How can I improve the loading of my datasets

Datatable vs Dataset

Community
  • 1
  • 1
CharithJ
  • 46,289
  • 20
  • 116
  • 131
0

It really depends on the sort of data you're bringing back. Since a DataSet is (in effect) just a collection of DataTable objects, you can return multiple distinct sets of data into a single, and therefore more manageable, object.

Performance wise dataset transferring takes more time than datatable since dataset is a collection of datatable

see this for more details

Community
  • 1
  • 1
Nighil
  • 4,099
  • 7
  • 30
  • 56
  • 1
    Not just a collection of `DataTable` - a DataSet also contains the data relations and even more overhead – marc_s Sep 27 '11 at 05:19
  • DataSet's are memory hungry. Do not use them if the DataTable's in question don't have any relationships between them. – Razor Sep 27 '11 at 05:56