Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET .NET LINQ
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 27-Nov-12 1:36am
Comments
digimanus at 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.
Mathlab at 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 at 27-Nov-12 11:11am
   
Totally wrong question. Better for what?!
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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"[^].
  Permalink  
Comments
Master.Man1980 at 27-Nov-12 15:08pm
   
good one
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 215
1 Suvendu Shekhar Giri 215
2 Andy Lanng 210
3 PIEBALDconsult 190
4 Abhinav S 184
0 Sergey Alexandrovich Kryukov 6,360
1 OriginalGriff 5,878
2 Peter Leow 2,514
3 Maciej Los 2,263
4 Abhinav S 2,249


Advertise | Privacy | Mobile
Web02 | 2.8.150414.1 | Last Updated 16 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100