Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par MohammadSalman Abbasi , Project Co-ordinator , AMC (Ahmedabad Municipal Corporation)
Date de publication: 2014/07/08
Zafar Ali Khan
par 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
par 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
par Mostafa ElFadaly , Senior Software Developer , MIU

DataReader If you  want to edit and add into retrieving data

Rameez Ahmed Sayad
par 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
par Jyothsna Rajaram , .NET Developer , Asteco Property Management

Dataset

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?