Hi..
What is the difference between dataset and datareader ? Please give example of both ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Oct 23, 2011, 11:17 PM
A datareader like a dataset is an object that:
1- reads one record at a time.
2- gives the values of that records
3- Detroy the memory allocation of the record
4-it is very small object that consumes very little memory and is optimize to do it very fast.Also it uses a connection called readonly, forwardonly.
A Dataset on the other hand will:
1. Create a schema that define structure of the data
2. Provide memory space to store all the records of a table that resulst from the select
3. Provide memory to store more than one table
4. Provide logic to relate the records on one table with the records on another
5. Identify the primary key of the records obtained (to do so it comunicates with the sql server to obtain the key of the record.
6. Provide mechanism to update and delete the records on the table.
7. Since the dataset runs disconected mode and the records in question can be changed from another process at the same time, the dataset will store the original value of the record and compare that value with the value on the database before updating the record. If the record was changed then the update will not proceed and you receive an error message.
Thanks
Vineet Kumar SainiPosted Dec 10, 2011, 1:53 AM
Prabhu RajaPosted Oct 24, 2011, 1:22 AM
Javeed M ShaikhPosted Oct 23, 2011, 9:42 PM
Please refer to the C# Corner article:
http://www.c-sharpcorner.com/UploadFile/john_charles/DataReaderAndDataSet03102006134650PM/DataReaderAndDataSet.aspx