July 15, 2010

DataReader vs DataSet

I've been quite frequently asked by the junior developers about the DataReader and DataSets -- so here it is.

Use DataReader For read-only data. For example, to bind custom object collection the ideal option is the DataReader. It is much faster than the DataSet.

Use DataSet to work on disconnected data. For example, to perform CRUD operations in disconnect like mode use DataSets.

I have written a performance test app for DataReader and DataSet. Download the code. Also I have written/discussed about the DataSets and Custom Collections half decade ago--http://www.ludmal.net/2005/05/datasets-vs-collections.html

Also download the Microsoft Application Architecture Guide.
http://apparchguide.codeplex.com/

No comments: