Are there any differences if I'm retrieving data in a DataSet instead of a DataTable [duplicate]
Possible Duplicate:
Datatabl开发者_如何学Pythone 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.
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
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
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
精彩评论