Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Performance And Pooling : Comparisons of Data Access Techniques

Why Use Dataset or a Datareader:

I work mostly with asp.net web applications, using business objects and the Data Access Application Block

When I need to choose between using a DataSet and a DataReader in an Asp.Net page, my default choice is the DataSet. The data being fetched is usually very small, ten or twenty records, and it keeps the asp simpler, not requiring any management of the connection in the page. I never need to call .Close after DataSet list = GetEmployeeList().

For any kind of large data the issue gets much more complex, a DataSet is not a place to put 800,000 rows.

The performance comparison articles show the performance advantages of the DataReader, but an important change happens when they introduce a delay of 20 milliseconds to represent some processing in the loop.

Performance Comparison: Data Access Techniques
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bdadotnetarch031.asp
The .NET Connection Pool Lifeguard
Prevent pool overflows that can drown your applications
http://www.sqlmag.com/Articles/Index.cfm?ArticleID=39031

2 Comments

  • You shouldn't be doing data access in your UI. Any loops you do with the data readers should have negligble performance impacts - 20 ms is A LOT !!! Something over a million MSIL instructions.

  • Udi:

    I try to avoid any direct data access in my presentation layer.



    I rarely have time to develop complete custom collections and data objects, so my buisness objects will usualy return untyped datasets.



    EmployeeListDataGrid.DataSource = BizObject.Employees.List;



    A million is a lot of intructions, you should write to the authors of the articles ;)



    I mostly meant to keep this page as a collection of links on the subject, if you have some good ones (you must) please post em.



Comments have been disabled for this content.