We mentioned in a previous article how to make good use of the "DataSourceMode attribute" ( http://www.cnblogs.com/liminzhang/archive/2006/12/18/595332.html ), which triggered a lot of responses. Everyone began to think that DataSet or DataReader should be used as the actual data source in Web Form web pages.
Here we further list the advantages and disadvantages of using DataReader and DataSet in Figure 1. Under normal circumstances, DataReader is not only faster than DataSet, but also uses less memory on the IIS server. Our suggestion is that if your data source control is only used to fill in the list of controls as its options, or if your data-bound control does not need to provide sorting or paging functions, you should use DataReader. On the other hand, if your data-bound control needs to provide sorting or paging functionality, you must use a DataSet and bear its negative effects.
DataSourceModeProperty |
advantage |
shortcoming |
DataReader |
faster |
Caching, paging and dynamic sorting are not supported. |
DataSet |
Supports caching, paging and dynamic sorting |
slower |