Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
When we should use the List<> object and when we should use the Dataset/Datatable object for fetching more than 10000 rows from database.
Posted
Comments
Herman<T>.Instance 27-Nov-12 8:08am    
well...if you have 10,000 records first in DataTable object and then set them to a List<>, that takes time you don't need. Better use SqlDataReader for speed.
But 10,000 to display? Your wenserver will not fetch that without some paging.
10,000 rows to process? Better do it in a database.
[no name] 27-Nov-12 9:57am    
If you are doing updates and inserts I use data table to preserve the format of the data. Once the data is in the Bussiness Logic or UI tier I like to use lists becasue I like to use LINQ.
Sergey Alexandrovich Kryukov 27-Nov-12 11:11am    
Totally wrong question. Better for what?!
--SA

if u don't care about how you are fetching data using dataadapter/ datareader but wants to know which data source collection will be helpful to u. U have to 1st think about what are u going to do with your data.
Datatable and dataset are good but heavy collection compare to other collections like list,array,dictionary etc. but Very useful (they have built-in many functionality like sort,filter, parent - child relation and many more). As their base is XML they are most portable collection with any system which support xml. WCF,web service absorb them easily without much help.
Now if you don't want above functionality. List ,array are better option.But still there is lot of secrets of optimization and performance.
If want to know real difference of such collections , follow this link http://www.dotnetperls.com/collections[.Net Collection].

http://www.dotnetperls.com/optimization[.Net Optimization]

If u like this solution ,plz accept as answer.
 
Share this answer
 
You probably meant to compare DataSet vs DataReader performance (because, in order to populate your list you need to somehow access the database).
Here you have a good reference: "Performance Comparison: Data Access Techniques"[^].
 
Share this answer
 
Comments
Master.Man1980 27-Nov-12 15:08pm    
good one
If you are fetching data from a database, you are likely grabbing more than one column of data. In that case, you should use a DataSet[^] and DataTable[^], which handle both columns and rows of data.

Lists[^] are like arrays in that they are a single collection. You'd use them if you had a simple one column list of data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900