Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 2nd, 2007, 02:01 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default Which is better Datareader or Dataset.

I am developing a website. in which all the dropdown lists and the gridview is populated from some table. I was using datasets to fetch data from database (in SQL server 2000), andthen I was assigning this dataset to be the datasource of that list or gridview. Recentaly one of my friends suggested that it is better to use datareader rather than datasource. I am in a dilema what to use. Specially keeping in mind that we are developing a website and not a desktop applications. Can somebody help me in deciding which is better ?

Akhilesh
 
Old April 2nd, 2007, 06:05 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I think it's generally accepted that a DataReader is faster than a DataSet. A DataReader provide forward only access and is optimized for that.

For me, doing primarily web development, I have generally preferred a DataReader because I would usually be getting data into one or more class instances and then working with the classes. Typically updates would be made one at a time thru T-SQL on a single record or value basis. In a windows app, using disconnected datasets would be more sensible because the DataSet can easily remain in memory where you can make many changes and then commit them back to the data source in a single action.

I don't think that you have to chose between "datareader versus datasource" because I'm not sure they are mutually exclusive. A data source is a source of data whether it's a DataReader, DataSet, or class instance (such as an array or collection). I suspect you may be confusing the terms "SqlDataSource", "ObjectDataSource", etc. with the "DataSource" property of data bound controls.

-Peter
 
Old April 3rd, 2007, 12:09 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default

Thank you very much for the reply. I am sorry that the Heading of the query is Datareader vs datasource whereas I intended to write Datreader vs Datasets. But ur reply has removed some of my doubts. Do we have any article on the topic on some site??
 
Old April 3rd, 2007, 07:38 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

http://www.google.com/search?q=datareader+vs+dataset

-Peter
 
Old April 10th, 2007, 04:43 AM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to johnysouriar
Default

data reader is much fater than dataset. Dataset consumes more memory . But if if u have more data and make modification on that then use dataset , bcoz it is working as disconnected way.
Hope u r problem is solved
Johny Sourair

Johny Souriar





Similar Threads
Thread Thread Starter Forum Replies Last Post
DataReader/DataSet mike_remember ASP.NET 1.0 and 1.1 Professional 10 April 10th, 2007 04:05 PM
Converting a untyped dataset to a typed dataset daphnean Visual Studio 2005 0 July 13th, 2006 01:16 AM
Re: SQL Server dataset to ACCESS dataset dazzer ADO.NET 0 March 22nd, 2004 05:28 AM
Using DataReader() aadz5 ASP.NET 1.0 and 1.1 Basics 12 November 21st, 2003 06:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.