53.4k views
4 votes
DataReader and DataAdapter are two classes in ADO .Net for accessing databases. Which statement is correct?

A.DataReader reads database in a stream, while DataAdapter reads in DataSet.
B.DataReader reads database in DataSet, while DataAdapter reads in a stream.
C.Both DataReader and DataAdapter read database in DataSet.
D.Both DataReader and DataAdapter read database in a stream.

1 Answer

2 votes

Final answer:

The correct statement is: option A) .DataReader reads database in a stream, while DataAdapter reads in DataSet.

Step-by-step explanation:

A DataReader in ADO .Net provides a forward-only, read-only stream of data from a database, allowing efficient retrieval of large amounts of data. On the other hand, a DataAdapter is used to fill and update a DataSet with data from a data source.

For example, if you need to retrieve a large number of records from a database and only need to read them once, you can use a DataReader.

On the other hand, if you need to work with the data in a disconnected manner and perform complex data operations, you can use a DataAdapter to fill a DataSet.

Therefore, the correct option is: A) DataReader reads database in a stream, while DataAdapter reads in DataSet.