DataSet Vs SqlDataReader

by top54u.com 15 May, 2008
Spotlight.....

In ASP.Net when you code for data access using ADO.Net components and classes to bind data retrieved from SQL Server Database or any other data source, you have three options such as SqlDataReader, DataSet and DataTable. For selecting one among these you have to choose according to the type of view or presentation of data you are providing to the user on web application. Coz every single object or component used has its own range of functionality and performance. And when the choice depends on SqlDataReader, DataSet and DataTable for implementing ADO.Net in ASP.Net web pages you have to go for performance first.

 

Data Fetching and Data Binding

All three objects mentioned above are well suited for ASP.Net applications and perfectly serves as data source for data bound controls. SqlDataReader implements IEnumerable generic collections interface that delimits it from serving directly as a data source to data bound controls where DataSet and DataTable implement IList generic interface that enable them to work as data source to wider variety of controls along with additional functionality.

 

Difference Between DataSet and SqlDataReader

Both these objects differ from each other due to their data holding design pattern. DataSet is collection of DataTable that can store the mini-in-memory relational view of data retrieved fro the database irrespective of data source used at back end such as Oracle, MS Access, SQL Server or MySQL. DataSet caches the view of data retrieved and serves disconnected stored copy of data. On the other hand SqlDataReader or you can say data reader is specifically designed for web applications to provide optimum performance that consumes memory to just forward-only the data row fetched from the database.
So you have to check the server control datasource property to bind the appropriate Data Object with it.

Where and How to use DataSet?

Spotlight.....

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , , ,

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

7/24/2008 5:27:49 PM

OUR SPONSORS[+ advertise here]
top54u ezines.....
related videos.....
recent posts.....