Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Which one is better to use in ADO.Net C#, data set or datareader?

user-image
Question added by MohammadSalman Abbasi , Project Co-ordinator , AMC (Ahmedabad Municipal Corporation)
Date Posted: 2014/07/08
Zafar Ali Khan
by Zafar Ali Khan , software engineer , White Wings Technologies

It depends on your needs. If you want to do readonly fast reading then use DataReader. And if you want to load data from multiple Tables. and you want to store it in single place. And you want to work with data after disconnectivity then Dataset is good.

DataSet is actually the collection of DataTables, DataRelations and you can load Data from Xml source also.

Santosh kumar mada
by Santosh kumar mada , Software developer , Thrinaina informatics pvt Ltd

that depends on the data you want from the database...you can go for data reader if you want a single record.....and if you want multiple records than you can go for dataset.. bcoz we can directly bind that to a data source..but when you use data reader for multiple records we cannot directly bind those records to an datasource. and for -loop is used to bind those records which is time consuming and repetetive 

Mostafa ElFadaly
by Mostafa ElFadaly , Senior Software Developer , MIU

DataReader If you  want to edit and add into retrieving data

Rameez Ahmed Sayad
by Rameez Ahmed Sayad , .Net Consultant , Proximus Luxembourg

If it's about retrieving the rows then use DataReader faster than DataAdapter.

DataReader is a connected model whereas Dataset is a disconnected , 

you can use DataReader to write to your DataSet through DataRow and DataTable

The difference being DataAdapter behind the scenes creates all the schema and directly adds rows to it . 

For DataReader , You will have to manually create the DataTable , then define the DataColumn, then create NewRow() and assign row by row through DataReader.

Jyothsna Rajaram
by Jyothsna Rajaram , .NET Developer , Asteco Property Management

Dataset

More Questions Like This